summary refs log tree commit diff
path: root/pkgs/build-support/fetchgitrevision/default.nix
blob: d1e96f4bee5b5709aa9fdc06bcab47589fcf69ce (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
    '');