From e941da311241c299b3431ea4c5917f1853b578de Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 16 Jul 2024 14:34:32 +0200 Subject: [PATCH] Create separate module for controlling software --- lib/modules/software.nix | 69 ++++++++++++++++++++++++++++++++++++++++ lib/modules/valhalla.nix | 61 ++--------------------------------- 2 files changed, 71 insertions(+), 59 deletions(-) create mode 100644 lib/modules/software.nix diff --git a/lib/modules/software.nix b/lib/modules/software.nix new file mode 100644 index 00000000..05bd7aa1 --- /dev/null +++ b/lib/modules/software.nix @@ -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; + }; + }; + }; + }; + } diff --git a/lib/modules/valhalla.nix b/lib/modules/valhalla.nix index f0f25979..7701bab5 100644 --- a/lib/modules/valhalla.nix +++ b/lib/modules/valhalla.nix @@ -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; - }; - }; }; }; }