summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorEduard Bachmakov <e.bachmakov@gmail.com>2014-12-27 21:43:04 +0100
committerEduard Bachmakov <e.bachmakov@gmail.com>2014-12-27 21:43:04 +0100
commit86cd055477ab91a6134a0bc437c3f6e24e0ac602 (patch)
tree0880d6aeaa106fec80ab7f9eb9a1b82fc96cc60e /nixos/modules/installer
parentcbe467ef9986289710ca49ab728d3bae22ba7ac4 (diff)
downloadnixlib-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.sh10
-rw-r--r--nixos/modules/installer/tools/tools.nix2
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;
   };
 
   /*