about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/build-support/fetchgitlocal/default.nix17
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchgitlocal/default.nix b/pkgs/build-support/fetchgitlocal/default.nix
index 04e6aafc8a1b..43fc4b1179d7 100644
--- a/pkgs/build-support/fetchgitlocal/default.nix
+++ b/pkgs/build-support/fetchgitlocal/default.nix
@@ -1,6 +1,19 @@
-{ runCommand, git }: src:
+{ runCommand, git, nix }: src:
 
-runCommand "local-git-export" {} ''
+let hash = import (runCommand "head-hash.nix"
+  { dummy = builtins.currentTime;
+    preferLocalBuild = true; }
+''
+  cd ${toString src}
+  (${git}/bin/git show && ${git}/bin/git diff) > $out
+  hash=$(${nix}/bin/nix-hash $out)
+  echo "\"$hash\"" > $out
+''); in
+
+runCommand "local-git-export"
+  { dummy = hash;
+    preferLocalBuild = true; }
+''
   cd ${toString src}
   mkdir -p "$out"
   for file in $(${git}/bin/git ls-files); do
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ab11bf12bb04..735faf76ddb8 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -330,7 +330,7 @@ let
   fetchgitrevision = import ../build-support/fetchgitrevision runCommand git;
 
   fetchgitLocal = import ../build-support/fetchgitlocal {
-    inherit runCommand git;
+    inherit runCommand git nix;
   };
 
   fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {});