summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2015-02-20 16:35:56 +0100
committerPeter Simons <simons@cryp.to>2015-02-20 16:35:56 +0100
commit263a49be2091b8752a45f7e8b269e599fdd709d1 (patch)
tree3ac79ae2813bb4dcf2e018d18141ab7596d2d86a /nixos
parenta638f8372922f9363d307a5410f83ec2911ddcf3 (diff)
parent86cd055477ab91a6134a0bc437c3f6e24e0ac602 (diff)
downloadnixlib-263a49be2091b8752a45f7e8b269e599fdd709d1.tar
nixlib-263a49be2091b8752a45f7e8b269e599fdd709d1.tar.gz
nixlib-263a49be2091b8752a45f7e8b269e599fdd709d1.tar.bz2
nixlib-263a49be2091b8752a45f7e8b269e599fdd709d1.tar.lz
nixlib-263a49be2091b8752a45f7e8b269e599fdd709d1.tar.xz
nixlib-263a49be2091b8752a45f7e8b269e599fdd709d1.tar.zst
nixlib-263a49be2091b8752a45f7e8b269e599fdd709d1.zip
Merge pull request #5704 from eduarrrd/nixos-version
Add option to display git revision to nixos-version
Diffstat (limited to 'nixos')
-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 63d2077fbe19..99a74b6d59ed 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;
   };
 
 in