diff options
author | Eduard Bachmakov <e.bachmakov@gmail.com> | 2014-12-27 21:43:04 +0100 |
---|---|---|
committer | Eduard Bachmakov <e.bachmakov@gmail.com> | 2014-12-27 21:43:04 +0100 |
commit | 86cd055477ab91a6134a0bc437c3f6e24e0ac602 (patch) | |
tree | 0880d6aeaa106fec80ab7f9eb9a1b82fc96cc60e /nixos/modules/installer | |
parent | cbe467ef9986289710ca49ab728d3bae22ba7ac4 (diff) | |
download | nixlib-86cd055477ab91a6134a0bc437c3f6e24e0ac602.tar nixlib-86cd055477ab91a6134a0bc437c3f6e24e0ac602.tar.gz nixlib-86cd055477ab91a6134a0bc437c3f6e24e0ac602.tar.bz2 nixlib-86cd055477ab91a6134a0bc437c3f6e24e0ac602.tar.lz nixlib-86cd055477ab91a6134a0bc437c3f6e24e0ac602.tar.xz nixlib-86cd055477ab91a6134a0bc437c3f6e24e0ac602.tar.zst nixlib-86cd055477ab91a6134a0bc437c3f6e24e0ac602.zip |
Add option to display git revision to nixos-version
Example use case: git checkout `nixos-version --hash`
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r-- | nixos/modules/installer/tools/nixos-version.sh | 10 | ||||
-rw-r--r-- | nixos/modules/installer/tools/tools.nix | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/installer/tools/nixos-version.sh b/nixos/modules/installer/tools/nixos-version.sh index 5dbf277fe4c4..51aa2dd82321 100644 --- a/nixos/modules/installer/tools/nixos-version.sh +++ b/nixos/modules/installer/tools/nixos-version.sh @@ -1,2 +1,10 @@ #! @shell@ -echo "@nixosVersion@ (@nixosCodeName@)" + +case "$1" in + --hash|--revision) + echo "@nixosRevision@" + ;; + *) + echo "@nixosVersion@ (@nixosCodeName@)" + ;; +esac diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 2c796250a982..2ba1dc0841e2 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -50,7 +50,7 @@ let nixos-version = makeProg { name = "nixos-version"; src = ./nixos-version.sh; - inherit (config.system) nixosVersion nixosCodeName; + inherit (config.system) nixosVersion nixosCodeName nixosRevision; }; /* |