Skip to content

Commit

Permalink
default.nix: Filter src attribute
Browse files Browse the repository at this point in the history
We can't use lib.cleanSource here, because we need to exclude a few
Python-specific files.

This should ensure that we don't constantly rebuild with a different
result link (because the latter is included into the store and thus
changes the build input).

Signed-off-by: aszlig <aszlig@nix.build>
  • Loading branch information
aszlig committed Nov 22, 2017
1 parent 966f708 commit dc5527d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,17 @@ pythonPackages.buildPythonPackage rec {
version = let
matchVersion = builtins.match ".*version=[\"']([^\"']+)[\"'].*";
in builtins.head (matchVersion (builtins.readFile ./setup.py));
src = ./.;

src = let
filter = path: type: let
name = baseNameOf (toString path);
dirCond = name == ".git" || name == "build" || name == "dist";
linkCond = builtins.match "result.*" name != null;
cond = builtins.match ".*\\.py[oc]$" name != null
|| builtins.match ".*\\.sw[a-z]$" name != null
|| name == "MANIFEST";
in if type == "directory" then !dirCond
else if type == "symlink" then !linkCond
else !cond;
in builtins.filterSource filter ./.;
}

0 comments on commit dc5527d

Please sign in to comment.