summary refs log tree commit diff
path: root/nixos/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorJan Malakhovski <oxij@oxij.org>2015-09-18 16:50:48 +0000
committerJan Malakhovski <oxij@oxij.org>2016-01-08 22:26:15 +0000
commit119c8f91e7f17d2cb95f42985816820600c389cf (patch)
tree0bd34b6a522114777f34668fb6d6c36c331eaea1 /nixos/modules/system/activation/top-level.nix
parent732eb3c4ccaac3312fe9334b5d77b3b88140c971 (diff)
downloadnixlib-119c8f91e7f17d2cb95f42985816820600c389cf.tar
nixlib-119c8f91e7f17d2cb95f42985816820600c389cf.tar.gz
nixlib-119c8f91e7f17d2cb95f42985816820600c389cf.tar.bz2
nixlib-119c8f91e7f17d2cb95f42985816820600c389cf.tar.lz
nixlib-119c8f91e7f17d2cb95f42985816820600c389cf.tar.xz
nixlib-119c8f91e7f17d2cb95f42985816820600c389cf.tar.zst
nixlib-119c8f91e7f17d2cb95f42985816820600c389cf.zip
nixos: introduce system.nixosLabel option and use it where appropriate
Setting nixosVersion to something custom is useful for meaningful GRUB
menus and /nix/store paths, but actuallly changing it rebulids the
whole system path (because of `nixos-version` script and manual
pages). Also, changing it is not a particularly good idea because you
can then be differentitated from other NixOS users by a lot of
programs that read /etc/os-release.

This patch introduces an alternative option that does all you want
from nixosVersion, but rebuilds only the very top system level and
/etc while using your label in the names of system /nix/store paths,
GRUB and other boot loaders' menus, getty greetings and so on.
Diffstat (limited to 'nixos/modules/system/activation/top-level.nix')
-rw-r--r--nixos/modules/system/activation/top-level.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index 81088a56fb12..1c242c88863d 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -67,7 +67,7 @@ let
 
       echo -n "$configurationName" > $out/configuration-name
       echo -n "systemd ${toString config.systemd.package.interfaceVersion}" > $out/init-interface-version
-      echo -n "$nixosVersion" > $out/nixos-version
+      echo -n "$nixosLabel" > $out/nixos-version
       echo -n "$system" > $out/system
 
       mkdir $out/fine-tune
@@ -101,7 +101,7 @@ let
     if [] == failed then pkgs.stdenv.mkDerivation {
       name = let hn = config.networking.hostName;
                  nn = if (hn != "") then hn else "unnamed";
-          in "nixos-system-${nn}-${config.system.nixosVersion}";
+          in "nixos-system-${nn}-${config.system.nixosLabel}";
       preferLocalBuild = true;
       allowSubstitutes = false;
       buildCommand = systemBuilder;
@@ -115,7 +115,7 @@ let
         config.system.build.installBootLoader
         or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
       activationScript = config.system.activationScripts.script;
-      nixosVersion = config.system.nixosVersion;
+      nixosLabel = config.system.nixosLabel;
 
       configurationName = config.boot.loader.grub.configurationName;