summary refs log tree commit diff
path: root/pkgs/build-support/fetchgitrevision/default.nix
blob: e877648978d9811543cdbb2ae606516aa4cabb15 (plain) (blame)
1
2
3
4
5
6
7
8
9
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
    '')