2020-08-13 19:54:51 +00:00
|
|
|
#! @runtimeShell@
|
2021-11-26 05:54:23 +00:00
|
|
|
# shellcheck shell=bash
|
2014-12-27 20:43:04 +00:00
|
|
|
|
|
|
|
case "$1" in
|
2016-07-13 07:11:32 +00:00
|
|
|
-h|--help)
|
2016-07-12 14:29:13 +00:00
|
|
|
exec man nixos-version
|
|
|
|
exit 1
|
2016-07-13 07:11:32 +00:00
|
|
|
;;
|
2014-12-27 20:43:04 +00:00
|
|
|
--hash|--revision)
|
2020-02-10 15:32:59 +00:00
|
|
|
if ! [[ @revision@ =~ ^[0-9a-f]+$ ]]; then
|
2023-01-03 19:16:50 +00:00
|
|
|
echo "$0: Nixpkgs commit hash is unknown" >&2
|
2020-02-10 14:25:44 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2017-04-01 00:00:00 +00:00
|
|
|
echo "@revision@"
|
2014-12-27 20:43:04 +00:00
|
|
|
;;
|
2021-02-06 17:32:26 +00:00
|
|
|
--configuration-revision)
|
|
|
|
if [[ "@configurationRevision@" =~ "@" ]]; then
|
|
|
|
echo "$0: configuration revision is unknown" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "@configurationRevision@"
|
|
|
|
;;
|
2019-09-13 16:58:55 +00:00
|
|
|
--json)
|
|
|
|
cat <<EOF
|
2020-02-10 14:25:24 +00:00
|
|
|
@json@
|
2019-09-13 16:58:55 +00:00
|
|
|
EOF
|
|
|
|
;;
|
2014-12-27 20:43:04 +00:00
|
|
|
*)
|
2017-04-01 00:00:00 +00:00
|
|
|
echo "@version@ (@codeName@)"
|
2014-12-27 20:43:04 +00:00
|
|
|
;;
|
|
|
|
esac
|