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:
parent
851024052d
commit
b89a42ef13
5 changed files with 68 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./profiles
|
||||||
|
|
||||||
./homeVars.nix
|
./homeVars.nix
|
||||||
./style.nix
|
./style.nix
|
||||||
./systemVars.nix
|
./systemVars.nix
|
||||||
|
|
7
modules/options/profiles/default.nix
Normal file
7
modules/options/profiles/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./desktop.nix
|
||||||
|
./gaming.nix
|
||||||
|
./server.nix
|
||||||
|
];
|
||||||
|
}
|
18
modules/options/profiles/desktop.nix
Normal file
18
modules/options/profiles/desktop.nix
Normal 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.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
18
modules/options/profiles/gaming.nix
Normal file
18
modules/options/profiles/gaming.nix
Normal 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.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
23
modules/options/profiles/server.nix
Normal file
23
modules/options/profiles/server.nix
Normal 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.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue