3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/installer/tools/nixos-version.sh
Eelco Dolstra c05cc615f2 nixos.revision: Use null instead of "master"
"master" is not a valid SHA-1 commit hash, and it's not even
necessarily the branch used. 'nixos-version --revision' now returns an
error if the commit hash is not known.
2020-02-10 15:45:15 +01:00

24 lines
341 B
Bash

#! @shell@
case "$1" in
-h|--help)
exec man nixos-version
exit 1
;;
--hash|--revision)
if ! [[ @revision@ =~ /[0-9a-f]+/ ]]; then
echo "$0: Nixpkgs commit hash is unknown"
exit 1
fi
echo "@revision@"
;;
--json)
cat <<EOF
@json@
EOF
;;
*)
echo "@version@ (@codeName@)"
;;
esac