nixos/plasma5: Make kwinrc/kdeglobals internally configurable

This is used with the Plasma Mobile configuration to configure the
system as upstream recommends.
This commit is contained in:
Samuel Dionne-Riel 2021-07-14 18:16:42 -04:00
parent b9a461490a
commit fde4f481d9

View file

@ -4,6 +4,28 @@ let
xcfg = config.services.xserver;
cfg = xcfg.desktopManager.plasma5;
# Use only for **internal** options.
# This is not exactly user-friendly.
kdeConfigurationType = with types;
let
valueTypes = (oneOf [
bool
float
int
str
]) // {
description = "KDE Configuration value";
emptyValue.value = "";
};
set = (nullOr (lazyAttrsOf valueTypes)) // {
description = "KDE Configuration set";
emptyValue.value = {};
};
in (lazyAttrsOf set) // {
description = "KDE Configuration file";
emptyValue.value = {};
};
libsForQt5 = pkgs.plasma5Packages;
inherit (libsForQt5) kdeGear kdeFrameworks plasma5;
inherit (pkgs) writeText;
@ -169,6 +191,20 @@ in
type = types.bool;
default = false;
};
# Internally allows configuring kdeglobals globally
kdeglobals = mkOption {
internal = true;
default = {};
type = kdeConfigurationType;
};
# Internally allows configuring kwin globally
kwinrc = mkOption {
internal = true;
default = {};
type = kdeConfigurationType;
};
};
imports = [
@ -418,6 +454,11 @@ in
services.xserver.displayManager.setupCommands = startplasma;
nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;
environment.etc = {
"xdg/kwinrc".text = lib.generators.toINI {} cfg.kwinrc;
"xdg/kdeglobals".text = lib.generators.toINI {} cfg.kdeglobals;
};
})
];
}