nixos: move nixosLabel to its own module
This commit is contained in:
parent
e1782e342f
commit
8200e08b0b
32
nixos/modules/misc/label.nix
Normal file
32
nixos/modules/misc/label.nix
Normal file
@ -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;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -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 {
|
nixosVersion = mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@ -89,7 +81,6 @@ 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 cfg.nixosVersion;
|
|
||||||
nixosVersion = mkDefault (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));
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
./misc/extra-arguments.nix
|
./misc/extra-arguments.nix
|
||||||
./misc/ids.nix
|
./misc/ids.nix
|
||||||
./misc/lib.nix
|
./misc/lib.nix
|
||||||
|
./misc/label.nix
|
||||||
./misc/locate.nix
|
./misc/locate.nix
|
||||||
./misc/meta.nix
|
./misc/meta.nix
|
||||||
./misc/nixpkgs.nix
|
./misc/nixpkgs.nix
|
||||||
|
Loading…
x
Reference in New Issue
Block a user