build(nix): filter src to reduce useless rebuilds

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 <tmuehlbacher@posteo.net>
This commit is contained in:
Thomas Mühlbacher 2024-06-10 23:22:00 +02:00
parent 3e50eea605
commit 922ba240c5

View File

@ -58,6 +58,7 @@
}:
let
inherit (builtins) readFile split;
inherit (lib) fileset;
inherit (lib.lists) findFirst;
inherit (lib.strings) hasPrefix removePrefix substring;
@ -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";