[Nix-dev] Using Nix for installing local projects

Alexander Foremny alexanderforemny at googlemail.com
Wed Jun 27 16:53:15 CEST 2012


Thank you. Those suggestions are helpful too, albeit they are quite
hacky. Especially since you cannot force a rebuild of an unchanged Nix
expression, but I suppose this is by design.

Regards,
Alexander Foremny

2012/6/27 Peter Simons <simons at cryp.to>:
> The following message is a courtesy copy of an article
> that has been posted to gmane.linux.distributions.nixos as well.
>
> Hi Alexander,
>
>  > Another option would be to specify a file path as src in
>  > cabal.mkDerivation. Is this possible?
>
> you could define "unpackPhase" to be something along the lines of:
>
>  rsync -a /home/yours/src/hoauth .
>
> This would make Nix build whatever you have in your working copy. It's
> not exactly a clean solution, but it would work.
>
> The alternative I tend to use is to define:
>
>  src = fetchgit {
>    url = "/home/yours/src/hoauth";
>    rev = "1cd915d689ec19d0348e1b30e1ba4c4c7dc97d8b";
>  };
>
> This means that I have to put my working copy under version control, but
> I actually like that, so it's okay for me.
>
> In any case, you'll find yourself editing the Nix expression every time
> you want to run a build, though, because Nix won't re-build unless
> something has changed. In my case, I set the "rev" field to the current
> HEAD of the repository. In the unpackPhase solution from above, you'd
> probably have to bump some "version" field to trigger a re-build.
>
> Generally speaking, I feel that Nix is just moderately useful for
> running local development builds. In the case of Haskell, you may find
> that tools like cabal-dev turn out to be easier to use in the end.
>
> Take care,
> Peter


More information about the nix-dev mailing list