(modules/flake) improve library loading and implement system class module mappings

This commit is contained in:
Jo 2025-01-29 12:17:34 +01:00
parent 7d16e19c8b
commit f139b88c0b
9 changed files with 144 additions and 73 deletions

View file

@ -1 +0,0 @@
{}

View file

@ -0,0 +1,19 @@
{
lib,
config,
namespace,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.${namespace}.desktop.gnome;
in
{
options.${namespace}.desktop.gnome = { enable = mkEnableOption "Enable the gnome desktop environment ${namespace}"; };
config = mkIf cfg.enable {
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
};
}

View file

@ -0,0 +1,43 @@
{
lib,
config,
namespace,
puzzlelib,
...
}:
let
inherit (lib) mkIf mkMerge;
inherit (puzzlelib) mkOpt mkBool;
cfg = config.${namespace}.utils.vm;
in
{
options.${namespace}.utils.vm = {
enable = mkBool true "Whether to enable custom vm presets";
preset = mkOpt lib.types.str "performance" "Specify the prefered vm settings preset: performance, balance or powersave";
};
config = mkIf cfg.enable {
virtualisation.vmVariant = mkMerge [
(mkIf cfg.preset == "performance" {
virtualisation = {
cores = 6;
memorySize = 4096;
graphics = true;
};
})
(mkIf cfg.preset == "balance" {
virtualisation = {
cores = 4;
memorySize = 2048;
};
})
(mkIf cfg.preset == "powersave" {
virtualisation = {
cores = 2;
memorySize = 1024;
};
})
];
};
}