From a3d359ccd683d616bac349901cd6b2704a9879b2 Mon Sep 17 00:00:00 2001 From: K900 Date: Thu, 15 May 2025 19:56:06 +0300 Subject: [PATCH] nixos/plasma6: add auto timezone handling polkit rule --- nixos/modules/services/desktop-managers/plasma6.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/modules/services/desktop-managers/plasma6.nix b/nixos/modules/services/desktop-managers/plasma6.nix index a11ab8ccdd51..ef9c66d1336d 100644 --- a/nixos/modules/services/desktop-managers/plasma6.nix +++ b/nixos/modules/services/desktop-managers/plasma6.nix @@ -357,6 +357,19 @@ in }; }; + # Upstream recommends allowing set-timezone and set-ntp so that the KCM and + # the automatic timezone logic work without user interruption. + # However, on NixOS NTP cannot be overwritten via dbus, and timezone + # can only be set if `time.timeZone` is set to `null`. So, we only allow + # set-timezone, and we only allow it when the timezone can actually be set. + security.polkit.extraConfig = lib.mkIf (config.time.timeZone != null) '' + polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.timedate1.set-timezone" && subject.active) { + return polkit.Result.YES; + } + }); + ''; + programs.dconf.enable = true; programs.firefox.nativeMessagingHosts.packages = [ kdePackages.plasma-browser-integration ];