]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
nix: refactor the cleanSource rules
authorSomeone Serge <redacted>
Sat, 13 Jan 2024 17:45:01 +0000 (17:45 +0000)
committerSomeone <redacted>
Mon, 22 Jan 2024 12:19:30 +0000 (12:19 +0000)
.devops/nix/package.nix

index e8534956f1d96224fdd33ac934f6f08c998f59b0..c25d99f01fae33e14eb4693f9553dcb6cd3d0b00 100644 (file)
@@ -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 ../../.;
     };