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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user