mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-26 14:00:51 +00:00
nix: filter source files
This speeds up the nix build by reducing the number of files that are copied to the nix store. Hopefully fixes #1095.
This commit is contained in:
parent
29db607e10
commit
3ca26974e6
1 changed files with 15 additions and 1 deletions
16
flake.nix
16
flake.nix
|
@ -34,6 +34,15 @@
|
|||
rust-overlay.overlays.default
|
||||
];
|
||||
};
|
||||
filterSrc = src: regexes:
|
||||
pkgs.lib.cleanSourceWith {
|
||||
inherit src;
|
||||
filter = path: type:
|
||||
let
|
||||
relPath = pkgs.lib.removePrefix (toString src + "/") (toString path);
|
||||
in
|
||||
pkgs.lib.all (re: builtins.match re relPath == null) regexes;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
|
@ -42,7 +51,12 @@
|
|||
version = "unstable-${self.shortRev or "dirty"}";
|
||||
buildNoDefaultFeatures = true;
|
||||
buildFeatures = [ "jujutsu-lib/legacy-thrift" ];
|
||||
src = ./.;
|
||||
src = filterSrc ./. [
|
||||
".*\\.nix$"
|
||||
"^.jj/"
|
||||
"^flake\\.lock$"
|
||||
"^target/"
|
||||
];
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue