mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-30 23:34:12 +03:00
23 lines
538 B
Plaintext
23 lines
538 B
Plaintext
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
|
|
if [ -n "$rev" ]; then
|
|
echo ".git.$rev"
|
|
fi
|
|
fi
|