niksos/modules/gui/quickshell/default.nix

54 lines
1.5 KiB
Nix

{
config,
inputs,
lib,
pkgs,
...
}: let
cfg = config.myOptions.programs.quickshell;
inherit (config.myOptions.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.myOptions.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 {
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}
'') ((filterAttrs (name: _: elem name cfg.enabledConfigs) defaultConfigs) // cfg.extraConfigs))}
'';
};
};
}