From 1e534e234b0a92bf06361fa41b7ac8691fdbc769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Sat, 23 Jul 2016 22:31:57 +0200 Subject: [PATCH] fix nixos-version --hash when building from git --- .../tools/{get-version-suffix => get-git-revision} | 2 +- nixos/modules/installer/tools/nixos-rebuild.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) rename nixos/modules/installer/tools/{get-version-suffix => get-git-revision} (95%) diff --git a/nixos/modules/installer/tools/get-version-suffix b/nixos/modules/installer/tools/get-git-revision similarity index 95% rename from nixos/modules/installer/tools/get-version-suffix rename to nixos/modules/installer/tools/get-git-revision index b8972cd57d22..b57d9cf9fa08 100644 --- a/nixos/modules/installer/tools/get-version-suffix +++ b/nixos/modules/installer/tools/get-git-revision @@ -17,6 +17,6 @@ getVersion() { if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then getVersion $nixpkgs if [ -n "$rev" ]; then - echo ".git.$rev" + echo "$rev" fi fi diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index 5ecdcdb3cdb5..80a4537375c4 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -311,9 +311,10 @@ fi # nixos-version shows something useful). if [ -n "$canRun" ]; then if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then - suffix=$($SHELL $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}" || true) - if [ -n "$suffix" ]; then - echo -n "$suffix" > "$nixpkgs/.version-suffix" || true + revision=$($SHELL $nixpkgs/nixos/modules/installer/tools/get-git-revision "${extraBuildFlags[@]}" || true) + if [ -n "$revision" ]; then + echo -n ".git.$revision" > "$nixpkgs/.version-suffix" || true + echo -n "$revision" > "$nixpkgs/.git-revision" || true fi fi fi