niksos/modules/gui/quickshell/default.nix
jacekpoz aee4459655
add enabledConfigs to the quickshell module
thank you diniamo for that filterAttrs line you're the actual goat
2024-04-15 23:20:04 +02:00

47 lines
1.3 KiB
Nix

{
config,
inputs,
lib,
pkgs,
...
}: with lib; let
cfg = config.myOptions.programs.quickshell;
inherit (config.myOptions.other.system) username;
defaultConfigs = {
powermenu = ./powermenu;
poz = ./poz;
};
in {
options.myOptions.programs.quickshell = {
enable = mkEnableOption "quickshell";
enabledConfigs = mkOption {
description = "enabled configs out of the defaults";
type = with types; listOf str;
default = [];
};
extraConfigs = mkOption {
description = "extra configs (no need to enable these)";
type = with types; attrsOf path;
default = {};
};
};
config = mkIf cfg.enable {
home-manager.users.${username} = {
home.packages = with pkgs; [
inputs.quickshell.packages.${pkgs.system}.default
# for da poz
qt6.qtsvg
];
xdg.configFile."quickshell/manifest.conf".text = ''
${concatStrings (mapAttrsToList (name: value: ''
${name} = ${value}
'') ((lib.filterAttrs (name: _: elem name cfg.enabledConfigs) defaultConfigs) // cfg.extraConfigs))}
'';
};
};
}