Create separate module for controlling software

This commit is contained in:
Manuel Thalmann 2024-07-16 14:34:32 +02:00
parent 6f3ed5b63a
commit 33d6077b9c
2 changed files with 71 additions and 59 deletions

69
lib/modules/software.nix Normal file
View file

@ -0,0 +1,69 @@
{ lib, config, ... }:
let
inherit (lib)
mkOption
types
;
cfg = config.valhalla;
in {
options = {
valhalla = {
software =
let
inherit (cfg.software)
common
school
;
in {
essential = mkOption {
type = types.bool;
description = "A value indicating whether essentials should be installed.";
default = true;
};
common = mkOption {
type = types.bool;
description = "A value indicating whether common software should be installed.";
default = true;
};
school = mkOption {
type = types.bool;
description = "A value indicating whether software for studies should be installed.";
default = false;
};
productivity = mkOption {
type = types.bool;
description = "A value indicating whether productivity apps should be installed.";
default = common || school;
};
socialMedia = mkOption {
type = types.bool;
description = "A value indicating whether social media apps should be installed.";
default = common;
};
media = mkOption {
type = types.bool;
description = "A value indicating whether media apps should be installed.";
default = common;
};
gaming = mkOption {
type = types.bool;
description = "A value indicating whether gaming apps should be installed.";
default = common;
};
coding = mkOption {
type = types.bool;
description = "A value indicating whether development apps should be installed.";
default = common;
};
};
};
};
}

View file

@ -1,16 +1,15 @@
{ lib, config, ... }:
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
cfg = config.valhalla;
in {
imports = [
./git.nix
./i18n.nix
./partition.nix
./software.nix
];
options = {
@ -46,62 +45,6 @@
description = "The X11 keyboard layout of the system.";
default = null;
};
software =
let
inherit (cfg.software)
common
school
;
in {
essential = mkOption {
type = types.bool;
description = "A value indicating whether essentials should be installed.";
default = true;
};
common = mkOption {
type = types.bool;
description = "A value indicating whether common software should be installed.";
default = true;
};
school = mkOption {
type = types.bool;
description = "A value indicating whether software for studies should be installed.";
default = false;
};
productivity = mkOption {
type = types.bool;
description = "A value indicating whether productivity apps should be installed.";
default = common || school;
};
socialMedia = mkOption {
type = types.bool;
description = "A value indicating whether social media apps should be installed.";
default = common;
};
media = mkOption {
type = types.bool;
description = "A value indicating whether media apps should be installed.";
default = common;
};
gaming = mkOption {
type = types.bool;
description = "A value indicating whether gaming apps should be installed.";
default = common;
};
coding = mkOption {
type = types.bool;
description = "A value indicating whether development apps should be installed.";
default = common;
};
};
};
};
}