summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSomeone Serge <sergei.kozlukov@aalto.fi>2024-01-13 17:45:01 +0000
committerSomeone <newkozlukov@gmail.com>2024-01-22 12:19:30 +0000
commit7251870780e2d572dd6f239d7a0bfe438c82fa74 (patch)
treeb66ddd5b267b4a67c5cf4ad4fef9dc0e62dd4b15
parentfe8b3c0d4b0d806e8b46660e24eaf4b90b8b385f (diff)
nix: refactor the cleanSource rules
-rw-r--r--.devops/nix/package.nix16
1 files changed, 12 insertions, 4 deletions
diff --git a/.devops/nix/package.nix b/.devops/nix/package.nix
index e8534956..c25d99f0 100644
--- a/.devops/nix/package.nix
+++ b/.devops/nix/package.nix
@@ -115,14 +115,22 @@ effectiveStdenv.mkDerivation (
pname = "llama-cpp${pnameSuffix}";
version = llamaVersion;
+ # Note: none of the files discarded here are visible in the sandbox or
+ # affect the output hash. This also means they can be modified without
+ # triggering a rebuild.
src = lib.cleanSourceWith {
filter =
name: type:
- !(builtins.any (_: _) [
+ let
+ noneOf = builtins.all (x: !x);
+ baseName = baseNameOf name;
+ in
+ noneOf [
(lib.hasSuffix ".nix" name) # Ignore *.nix files when computing outPaths
- (name == "README.md") # Ignore *.md changes whe computing outPaths
- (lib.hasPrefix "." name) # Skip hidden files and directories
- ]);
+ (lib.hasSuffix ".md" name) # Ignore *.md changes whe computing outPaths
+ (lib.hasPrefix "." baseName) # Skip hidden files and directories
+ (baseName == "flake.lock")
+ ];
src = lib.cleanSource ../../.;
};