Remove $NIXOS_LABEL and $NIXOS_VERSION

Relying on environment variables to override configuration options is
ugly, and there is no reason for them.
This commit is contained in:
Eelco Dolstra 2016-07-28 18:10:17 +02:00
parent 0a1703ba27
commit 2a05368ff3

View File

@ -35,23 +35,8 @@ in
nixosLabel = mkOption { nixosLabel = mkOption {
type = types.str; type = types.str;
description = '' description = ''
NixOS version name to be used in the names of generated Label to be used in the names of generated outputs and boot
outputs and boot labels. labels.
If you ever wanted to influence the labels in your GRUB menu,
this is option is for you.
Can be set directly or with <envar>NIXOS_LABEL</envar>
environment variable for <command>nixos-rebuild</command>,
e.g.:
<screen>
#!/bin/sh
today=`date +%Y%m%d`
branch=`(cd nixpkgs ; git branch 2>/dev/null | sed -n '/^\* / { s|^\* ||; p; }')`
revision=`(cd nixpkgs ; git rev-parse HEAD)`
export NIXOS_LABEL="$today.$branch-''${revision:0:7}"
nixos-rebuild switch</screen>
''; '';
}; };
@ -102,8 +87,8 @@ in
system = { system = {
# These defaults are set here rather than up there so that # These defaults are set here rather than up there so that
# changing them would not rebuild the manual # changing them would not rebuild the manual
nixosLabel = mkDefault (maybeEnv "NIXOS_LABEL" cfg.nixosVersion); nixosLabel = mkDefault cfg.nixosVersion;
nixosVersion = mkDefault (maybeEnv "NIXOS_VERSION" (cfg.nixosRelease + cfg.nixosVersionSuffix)); nixosVersion = mkDefault (cfg.nixosRelease + cfg.nixosVersionSuffix);
nixosRevision = mkIf (pathIsDirectory gitRepo) (mkDefault gitCommitId); nixosRevision = mkIf (pathIsDirectory gitRepo) (mkDefault gitCommitId);
nixosVersionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId)); nixosVersionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId));