diff options
Diffstat (limited to 'pkgs/populate/program.nix')
| -rw-r--r-- | pkgs/populate/program.nix | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkgs/populate/program.nix b/pkgs/populate/program.nix index 06cfa07..fbb364c 100644 --- a/pkgs/populate/program.nix +++ b/pkgs/populate/program.nix @@ -8,17 +8,18 @@ in rustPlatform.buildRustPackage { pname = cargoToml.package.name; inherit (cargoToml.package) version; - # Only what cargo builds from, so changes to the Nix files or the docs - # don't rebuild the program. + # Without what cargo doesn't build from, so changes to the Nix files or + # the docs don't rebuild the program. By names, not by paths relative to + # this directory: the paths the filter gets needn't start with + # toString ./., e.g. if a symlink leads to this directory. src = builtins.path { name = "populate-src"; path = ./.; filter = path: type: let - relative = builtins.substring - (builtins.stringLength (toString ./.) + 1) (-1) (toString path); + name = baseNameOf path; in - builtins.elem relative [ "Cargo.toml" "Cargo.lock" "src" ] || - builtins.substring 0 4 relative == "src/"; + !(builtins.elem name [ ".gitignore" "docs" "target" ] || + builtins.match ".*\\.nix" name != null); }; cargoLock.lockFile = ./Cargo.lock; } |
