From bb363dd2f20ce6a5bd39498a3ec379dd031117d9 Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Tue, 31 Mar 2015 19:58:19 -0700 Subject: 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... --- pkgs/build-support/fetchgitlocal/default.nix | 17 +++++++++++++++-- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fetchgitlocal/default.nix b/pkgs/build-support/fetchgitlocal/default.nix index 04e6aafc8a1b..43fc4b1179d7 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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ab11bf12bb04..735faf76ddb8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {}); -- cgit 1.4.1