Skip to content

Commit 5586b14

Browse files
committed
flake: sources filter
1 parent c2ae2b3 commit 5586b14

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

flake.nix

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,26 @@
2929
pkgs = nixpkgs.legacyPackages.${system};
3030

3131
inherit (pkgs) lib;
32-
3332
craneLib = crane.mkLib pkgs;
33+
34+
# This filter prevent project from being rebuilded then changing
35+
# unrelated files ,e.g. README
36+
filter' =
37+
path: _type:
38+
builtins.match (lib.concatStringsSep "|" [
39+
".*tera"
40+
".*yaml"
41+
".*zstd"
42+
".*snap"
43+
".*sh"
44+
".+LICENSE.md"
45+
]) path != null;
46+
filter = path: type: (filter' path type) || (craneLib.filterCargoSources path type);
47+
src = lib.cleanSourceWith {
3448
src = ./.;
49+
inherit filter;
50+
name = "source";
51+
};
3552

3653
# Common arguments can be set here to avoid repeating them later
3754
common = {

0 commit comments

Comments
 (0)