2013-01-16 16:06:50 +01:00
|
|
|
getVersion() {
|
|
|
|
local dir="$1"
|
|
|
|
rev=
|
|
|
|
if [ -e "$dir/.git" ]; then
|
|
|
|
if [ -z "$(type -P git)" ]; then
|
|
|
|
echo "warning: Git not found; cannot figure out revision of $dir" >&2
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
cd "$dir"
|
|
|
|
rev=$(git rev-parse --short HEAD)
|
|
|
|
if git describe --always --dirty | grep -q dirty; then
|
|
|
|
rev+=M
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-10-01 13:45:14 +02:00
|
|
|
if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then
|
|
|
|
getVersion $nixpkgs
|
2013-01-16 16:06:50 +01:00
|
|
|
if [ -n "$rev" ]; then
|
2016-08-09 14:11:29 +02:00
|
|
|
echo ".git.$rev"
|
2013-01-16 16:06:50 +01:00
|
|
|
fi
|
|
|
|
fi
|