[Nix-dev] Building with default.nix

Daniel Barlow dan at telent.net
Thu Aug 11 18:50:49 CEST 2016


Have you considered using builtins.filterSource ?  I usually do something
like this:

let sourceFilesOnly = path: type:
    (lib.hasPrefix "var" (toString path)) ||
    (lib.hasPrefix "target" (toString path)) ;
in stdenv.mkDerivation {
    src = builtins.filterSource sourceFilesOnly ./.;
    # ...

It's not as tight as "git tracked files only" but works well enough for
e.g. Clojure projects where I can reasonably get build artefacts to go into
target/ so at least I'm not copying huge jar files into the store.
Likewise in a Ruby project I'd exclude vendor/bundle the same way

Any use?

-dan

-- 
dan at telent.net
http://ww.telent.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160811/ce119705/attachment.html>


More information about the nix-dev mailing list