diff options
Diffstat (limited to 'pkgs/build-support/fetchgitlocal/default.nix')
-rw-r--r-- | pkgs/build-support/fetchgitlocal/default.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchgitlocal/default.nix b/pkgs/build-support/fetchgitlocal/default.nix new file mode 100644 index 000000000000..43fc4b1179d7 --- /dev/null +++ b/pkgs/build-support/fetchgitlocal/default.nix @@ -0,0 +1,23 @@ +{ runCommand, git, nix }: src: + +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 + mkdir -p "$out/$(dirname $file)" + cp -d $file "$out/$file" || true # don't fail when trying to copy a directory + done +'' |