From 8200e08b0b553983cae0d505c51494061a98f2c0 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Mon, 1 Aug 2016 00:00:00 +0000 Subject: [PATCH] nixos: move nixosLabel to its own module --- nixos/modules/misc/label.nix | 32 ++++++++++++++++++++++++++++++++ nixos/modules/misc/version.nix | 9 --------- nixos/modules/module-list.nix | 1 + 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 nixos/modules/misc/label.nix diff --git a/nixos/modules/misc/label.nix b/nixos/modules/misc/label.nix new file mode 100644 index 00000000000..30d8fc9952b --- /dev/null +++ b/nixos/modules/misc/label.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.system; +in + +{ + + options.system = { + + nixosLabel = mkOption { + type = types.str; + description = '' + NixOS version name to be used in the names of generated + outputs and boot labels. + + If you ever wanted to influence the labels in your GRUB menu, + this is the option for you. + ''; + }; + + }; + + config = { + # This is set here rather than up there so that changing it would + # not rebuild the manual + system.nixosLabel = mkDefault cfg.nixosVersion; + }; + +} diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 48cde2ebbc8..83427d26fff 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -32,14 +32,6 @@ in ''; }; - nixosLabel = mkOption { - type = types.str; - description = '' - Label to be used in the names of generated outputs and boot - labels. - ''; - }; - nixosVersion = mkOption { internal = true; type = types.str; @@ -89,7 +81,6 @@ in system = { # These defaults are set here rather than up there so that # changing them would not rebuild the manual - nixosLabel = mkDefault cfg.nixosVersion; nixosVersion = mkDefault (cfg.nixosRelease + cfg.nixosVersionSuffix); nixosRevision = mkIf (pathIsDirectory gitRepo) (mkDefault gitCommitId); nixosVersionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId)); diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 35f5e87d7e5..7fd71b0fe5e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -60,6 +60,7 @@ ./misc/extra-arguments.nix ./misc/ids.nix ./misc/lib.nix + ./misc/label.nix ./misc/locate.nix ./misc/meta.nix ./misc/nixpkgs.nix