Create separate module for controlling software

This commit is contained in:
Manuel Thalmann 2024-07-16 14:34:32 +02:00
parent 5b2939b7a5
commit e941da3112
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 let
inherit (lib) inherit (lib)
mkOption mkOption
types types
; ;
cfg = config.valhalla;
in { in {
imports = [ imports = [
./git.nix ./git.nix
./i18n.nix ./i18n.nix
./partition.nix ./partition.nix
./software.nix
]; ];
options = { options = {
@ -46,62 +45,6 @@
description = "The X11 keyboard layout of the system."; description = "The X11 keyboard layout of the system.";
default = null; 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;
};
};
}; };
}; };
} }