[Nix-dev] Using Nix for installing local projects

Peter Simons simons at cryp.to
Wed Jun 27 16:44:08 CEST 2012


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