From 922ba240c524d5e73be860f5407ce9b55a661c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Mon, 10 Jun 2024 23:22:00 +0200 Subject: [PATCH] build(nix): filter src to reduce useless rebuilds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- flake.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 963dee11..c95912c3 100644 --- a/flake.nix +++ b/flake.nix @@ -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";