diff options
Diffstat (limited to 'pkgs/build-support/fetchgitrevision/default.nix')
-rw-r--r-- | pkgs/build-support/fetchgitrevision/default.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchgitrevision/default.nix b/pkgs/build-support/fetchgitrevision/default.nix new file mode 100644 index 000000000000..e877648978d9 --- /dev/null +++ b/pkgs/build-support/fetchgitrevision/default.nix @@ -0,0 +1,10 @@ +runCommand: git: repository: branch: + import (runCommand "head-revision" + { buildInputs = [ git ]; + dummy = builtins.currentTime; + } + '' + rev=$(git ls-remote ${repository} | grep "refs/${branch}$" | awk '{ print $1 }') + echo "[ \"$rev\" ]" > $out + echo Latest revision in ${branch} is $rev + '') |