nix/home-manager/meta.nix

60 lines
No EOL
2.3 KiB
Nix

{ lib, config, ... }:
{
options.meta.home-manager = {
# Presets for easy configuring the configuration
preset = lib.mkOption {
type = lib.types.nullOr (lib.types.enum [ "plasma-desktop" "cli" ]);
default = null;
defaultText = lib.literalExpression "null";
description = ''
The preset to use for enabling individual home-manager meta configuration options.
Presets:
- plasma-desktop
- Will enable anything that requires a desktop, and plasma-specific configuration
- cli
- Will only enable what is necessary for a CLI environment, excluding everything else
'';
};
# Individual configuration options
beets.enable = lib.mkEnableOption "beets configuration";
desktop = {
enable = lib.mkEnableOption "configuration that requires a desktop environment";
plasma.enable = lib.mkEnableOption "plasma configuration";
};
email = {
enable = lib.mkEnableOption "email configuration";
thunderbird.enable = lib.mkEnableOption "email configuration for thunderbird";
};
firefox.enable = lib.mkEnableOption "firefox configuration";
rescrobbled.enable = lib.mkEnableOption "rescrobbled configuration";
vscode.enable = lib.mkEnableOption "vscode configuration";
};
# Handle preset logic
config.meta.home-manager = lib.mkMerge [
# Desktop w/ Plasma preset
(lib.mkIf (config.meta.home-manager.preset == "plasma-desktop") {
beets.enable = true;
desktop.enable = true;
desktop.plasma.enable = true;
email.enable = true;
email.thunderbird.enable = true;
firefox.enable = true;
rescrobbled.enable = true;
vscode.enable = true;
})
# CLI Preset
(lib.mkIf (config.meta.home-manager.preset == "cli") {
beets.enable = false;
desktop.enable = false;
desktop.plasma.enable = false;
email.enable = false;
email.thunderbird.enable = false;
firefox.enable = false;
rescrobbled.enable = false;
vscode.enable = false;
})
];
}