From 0ec2cd5a3e5c701f47d14e4ee56f613dabc63c08 Mon Sep 17 00:00:00 2001 From: Sapphire Date: Sun, 28 Sep 2025 23:14:04 -0500 Subject: [PATCH] Filter src in flake --- flake.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 93304fe4..5ad911ff 100644 --- a/flake.nix +++ b/flake.nix @@ -26,7 +26,21 @@ ]; package = pkgs.enableDebugging (pkgs.wivrn.overrideAttrs (finalAttrs: oldAttrs: { - src = ./.; + # Filter the directories and files we don't need to keep to avoid needless rebuilds + src = lib.cleanSourceWith { + filter = name: type: let + baseName = baseNameOf (toString name); + in + (lib.cleanSourceFilter name type) && + !( + (type == "directory" && ( + baseName == ".direnv" + || baseName == ".cxx" + || lib.hasPrefix "build" baseName)) + || baseName == ".envrc" + ); + src = ./.; + }; version = "next"; # Because src is just a folder path and not a set from a fetcher, it doesn't need to be unpacked, so having a postUnpack throws an error.