6 cfg = config.system.nixos;
13 nixos.label = mkOption {
14 type = types.strMatching "[a-zA-Z0-9:_\\.-]*";
16 NixOS version name to be used in the names of generated
17 outputs and boot labels.
19 If you ever wanted to influence the labels in your GRUB menu,
20 this is the option for you.
22 It can only contain letters, numbers and the following symbols:
23 `:`, `_`, `.` and `-`.
25 The default is {option}`system.nixos.tags` separated by
26 "-" + "-" + {env}`NIXOS_LABEL_VERSION` environment
27 variable (defaults to the value of
28 {option}`system.nixos.version`).
30 Can be overridden by setting {env}`NIXOS_LABEL`.
32 Useful for not loosing track of configurations built from different
33 nixos branches/revisions, e.g.:
38 branch=`(cd nixpkgs ; git branch 2>/dev/null | sed -n '/^\* / { s|^\* ||; p; }')`
39 revision=`(cd nixpkgs ; git rev-parse HEAD)`
40 export NIXOS_LABEL_VERSION="$today.$branch-''${revision:0:7}"
46 nixos.tags = mkOption {
47 type = types.listOf types.str;
49 example = [ "with-xen" ];
51 Strings to prefix to the default
52 {option}`system.nixos.label`.
54 Useful for not loosing track of configurations built with
55 different options, e.g.:
59 system.nixos.tags = [ "with-xen" ];
60 virtualisation.xen.enable = true;
69 # This is set here rather than up there so that changing it would
70 # not rebuild the manual
71 system.nixos.label = mkDefault (maybeEnv "NIXOS_LABEL"
72 (concatStringsSep "-" ((sort (x: y: x < y) cfg.tags)
73 ++ [ (maybeEnv "NIXOS_LABEL_VERSION" cfg.version) ])));