[Nix-dev] Building with default.nix

Rodney Lorrimar dev at rodney.id.au
Mon Aug 8 23:15:17 CEST 2016


Hello nix-dev,

I was wondering, what is the best way to develop a project outside of
nixpkgs? My current method is something like this:

    # default.nix
    { sampleproject ? { outPath = ./.; name = "sampleproject"; }
    , pkgs ? import <nixpkgs> {}
    }:
    with pkgs.python35Packages;
    buildPythonPackage rec {
      name = "sampleproject-${version}";
      version = "1.2.0";
      src = [ sampleproject ];
      propagatedBuildInputs = [ peppercorn ];
    };

(Full project example here: https://github.com/rvl/sampleproject)

In many ways it works well, but I'm not entirely happy.

The problem is that my entire work tree (and all the accumulated project
cruft) gets copied into the nix store every time I run nix-build or
nix-shell. This is slow and also prints the scary "may run out of
memory" warning.

Is there a function to load only the tracked files from a git work tree?
Ideally this function would result in same store path if the files are
the same, so nothing need be rebuilt if no sources changed.


Cheers,

Rodney


More information about the nix-dev mailing list