1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-19 03:47:13 -04:00
nixpkgs/nixos/modules/installer/tools/get-version-suffix

23 lines
538 B
Plaintext
Raw Normal View History

2013-01-16 10:06:50 -05: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
}
if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then
getVersion $nixpkgs
2013-01-16 10:06:50 -05:00
if [ -n "$rev" ]; then
echo ".git.$rev"
2013-01-16 10:06:50 -05:00
fi
fi