mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos-rebuild: inline get-version-suffix script
It has no other consumers anyway. Also saves some work.
This commit is contained in:
parent
7df54fcf63
commit
1bf0ffb22e
2 changed files with 21 additions and 24 deletions
|
@ -1,23 +0,0 @@
|
|||
getVersion() {
|
||||
local dir="$1"
|
||||
rev=
|
||||
gitDir="$dir/.git"
|
||||
if [ -e "$gitDir" ]; 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 --git-dir="$gitDir" rev-parse --short HEAD)
|
||||
if git --git-dir="$gitDir" 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
|
Loading…
Add table
Add a link
Reference in a new issue