diff options
author | Eric Seidel <gridaphobe@gmail.com> | 2015-03-31 19:58:19 -0700 |
---|---|---|
committer | Eric Seidel <gridaphobe@gmail.com> | 2015-03-31 20:00:00 -0700 |
commit | bb363dd2f20ce6a5bd39498a3ec379dd031117d9 (patch) | |
tree | 4aca2de41e08508bcc00f042926b8c5cc94ccf87 /pkgs/build-support/fetchgitlocal | |
parent | 80c6c5e9eca6ed6c570497317c27bbef2354b236 (diff) |
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...
Diffstat (limited to 'pkgs/build-support/fetchgitlocal')
-rw-r--r-- | pkgs/build-support/fetchgitlocal/default.nix | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/pkgs/build-support/fetchgitlocal/default.nix b/pkgs/build-support/fetchgitlocal/default.nix index 04e6aafc8a1b0..43fc4b1179d78 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 |