Skip to content

Commit

Permalink
build(nix): filter src to reduce useless rebuilds
Browse files Browse the repository at this point in the history
This in particular speeds up the dev/run/debug cycle for writing more
tests. Without this, the actual bcachefs-tools package will be rebuilt
by Nix all the time because of changes to files that are tracked by git.
Even when it's changes in parts that aren't relevant to that package
build such as `checks/*`.

Signed-off-by: Thomas Mühlbacher <[email protected]>
  • Loading branch information
tmuehlbacher committed Jun 22, 2024
1 parent 7aa8c86 commit 0f8caaf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
}:
let
inherit (builtins) readFile split;
inherit (lib) fileset;
inherit (lib.lists) findFirst;
inherit (lib.strings) hasPrefix removePrefix substring;

Expand All @@ -74,7 +75,17 @@

commonArgs = {
inherit version;
src = self;
src = fileset.toSource {
root = ./.;

fileset = fileset.difference (fileset.gitTracked ./.) (
fileset.unions [
./checks
./doc
./tests
]
);
};

env = {
PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system";
Expand Down

0 comments on commit 0f8caaf

Please sign in to comment.