From fde4f481d992cd1b064844b70905814880aa6627 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Wed, 14 Jul 2021 18:16:42 -0400 Subject: [PATCH] nixos/plasma5: Make kwinrc/kdeglobals internally configurable This is used with the Plasma Mobile configuration to configure the system as upstream recommends. --- .../services/x11/desktop-managers/plasma5.nix | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix index 8a1793484e23..9191a54e2b1b 100644 --- a/nixos/modules/services/x11/desktop-managers/plasma5.nix +++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix @@ -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; + }; }) ]; }