From 68ba59578352815ac372b17fb3df9db39afb1407 Mon Sep 17 00:00:00 2001 From: Guangqing Chen Date: Sun, 5 Mar 2023 16:47:06 +0800 Subject: [PATCH] xfconf: fix dbus may not be started in the startup of NixOS. (#3707) --- modules/misc/xfconf.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/misc/xfconf.nix b/modules/misc/xfconf.nix index b4141bf5..a56ecbb5 100644 --- a/modules/misc/xfconf.nix +++ b/modules/misc/xfconf.nix @@ -97,6 +97,19 @@ in { commands = mapAttrsToList (channel: properties: mapAttrsToList (mkCommand channel) properties) cfg.settings; - in concatMapStrings concatStrings commands); + + load = pkgs.writeShellScript "load-xfconf" + (concatMapStrings concatStrings commands); + in '' + if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then + export DBUS_RUN_SESSION_CMD="" + else + export DBUS_RUN_SESSION_CMD="${pkgs.dbus}/bin/dbus-run-session --dbus-daemon=${pkgs.dbus}/bin/dbus-daemon" + fi + + $DRY_RUN_CMD $DBUS_RUN_SESSION_CMD ${load} + + unset DBUS_RUN_SESSION_CMD + ''); }; }