fetchgitlocal: use output of git show and git diff to tell nix whether the source has changed.

this is way more hacky than i was hoping...
This commit is contained in:
Eric Seidel 2015-03-31 19:58:19 -07:00
parent 80c6c5e9ec
commit bb363dd2f2
2 changed files with 16 additions and 3 deletions

View file

@ -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

View file

@ -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 {});