mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 18:23:09 +00:00
bb363dd2f2
this is way more hacky than i was hoping...
24 lines
586 B
Nix
24 lines
586 B
Nix
{ 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
|
|
''
|