1{ runCommand, git, nix }: src:
2
3let hash = import (runCommand "head-hash.nix"
4 { dummy = builtins.currentTime;
5 preferLocalBuild = true; }
6''
7 cd ${toString src}
8 (${git}/bin/git show && ${git}/bin/git diff) > $out
9 hash=$(${nix}/bin/nix-hash $out)
10 echo "\"$hash\"" > $out
11''); in
12
13runCommand "local-git-export"
14 { dummy = hash;
15 preferLocalBuild = true; }
16''
17 cd ${toString src}
18 mkdir -p "$out"
19 for file in $(${git}/bin/git ls-files); do
20 mkdir -p "$out/$(dirname $file)"
21 cp -d $file "$out/$file" || true # don't fail when trying to copy a directory
22 done
23''