niksos/modules/gui/quickshell/default.nix

54 lines
1.5 KiB
Nix

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