2020-08-20 17:08:02 +00:00
|
|
|
#! @runtimeShell@
|
2021-12-06 16:07:01 +00:00
|
|
|
# shellcheck shell=bash
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
-h|--help)
|
|
|
|
exec man nixos-version
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
--hash|--revision)
|
|
|
|
if ! [[ @revision@ =~ ^[0-9a-f]+$ ]]; then
|
2023-01-11 07:51:40 +00:00
|
|
|
echo "$0: Nixpkgs commit hash is unknown" >&2
|
2020-04-24 23:36:52 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "@revision@"
|
|
|
|
;;
|
2023-01-11 07:51:40 +00:00
|
|
|
--configuration-revision)
|
|
|
|
if [[ "@configurationRevision@" =~ "@" ]]; then
|
|
|
|
echo "$0: configuration revision is unknown" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "@configurationRevision@"
|
|
|
|
;;
|
2020-04-24 23:36:52 +00:00
|
|
|
--json)
|
|
|
|
cat <<EOF
|
|
|
|
@json@
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "@version@ (@codeName@)"
|
|
|
|
;;
|
|
|
|
esac
|