1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00
nixpkgs/pkgs/build-support/fetchgitrevision/default.nix

11 lines
328 B
Nix
Raw Normal View History

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
'')