nix/home-manager/meta.nix
2024-12-21 22:33:52 -07:00

67 lines
2.6 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";
interface = lib.mkOption {
type = lib.types.enum [ "nixos" "nix-on-droid" ];
default = "nixos";
defaultText = lib.literalExpression ''"nixos"'';
description = "The interface to use for configuring home-manger as a module";
};
};
# 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;
})
];
}