modules/options: add profiles

The next step in the refactoring is to add different profiles, so that
we may toggle them easily in our hosts. Here's the profiles I went for:

- desktop: enables everything a desktop computer needs (graphics,
productivity apps, base apps such as browsers...)
- gaming: enables gaming configurations (steam, gamescope...)
- server: enables server configurations (website hosting, git forge...)

I made sure the server profile can not be enabled if desktop/gaming are
enabled, as it would not make sense to have desktop applications and
configurations on a server.
This commit is contained in:
Anthony Rodriguez 2025-01-14 11:59:59 +01:00
parent 851024052d
commit b89a42ef13
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
5 changed files with 68 additions and 0 deletions

View file

@ -1,5 +1,7 @@
{
imports = [
./profiles
./homeVars.nix
./style.nix
./systemVars.nix

View file

@ -0,0 +1,7 @@
{
imports = [
./desktop.nix
./gaming.nix
./server.nix
];
}

View file

@ -0,0 +1,18 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption;
in {
options = {
local.profiles.desktop.enable = mkEnableOption "the desktop profile";
};
config.assertions = [
{
assertion = !config.local.profiles.server.enable;
message = "The desktop profile cannot be enabled if `local.profiles.server.enable` is set to true.";
}
];
}

View file

@ -0,0 +1,18 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption;
in {
options = {
local.profiles.gaming.enable = mkEnableOption "the gaming profile";
};
config.assertions = [
{
assertion = !config.local.profiles.server.enable;
message = "The gaming profile cannot be enabled if `local.profiles.server.enable` is set to true.";
}
];
}

View file

@ -0,0 +1,23 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption;
in {
options = {
local.profiles.server.enable = mkEnableOption "the server profile";
};
config.assertions = [
{
assertion = !config.local.profiles.desktop.enable;
message = "The server profile cannot be enabled if `local.profiles.desktop.enable` is set to true.";
}
{
assertion = !config.local.profiles.gaming.enable;
message = "The server profile cannot be enabled if `local.profiles.gaming.enable` is set to true.";
}
];
}