From 86cd055477ab91a6134a0bc437c3f6e24e0ac602 Mon Sep 17 00:00:00 2001 From: Eduard Bachmakov Date: Sat, 27 Dec 2014 21:43:04 +0100 Subject: Add option to display git revision to nixos-version Example use case: git checkout `nixos-version --hash` --- nixos/modules/installer/tools/nixos-version.sh | 10 +++++++++- nixos/modules/installer/tools/tools.nix | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'nixos/modules/installer') 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; }; /* -- cgit 1.4.1