diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 66d25b01..1d016da6 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -393,7 +393,12 @@ let variables = concatStringsSep " " cfg.systemd.variables; extraCommands = concatStringsSep " && " cfg.systemd.extraCommands; - systemdActivation = ''exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables}; ${extraCommands}"''; + systemdActivation = + { + broker = ''exec "systemctl --user import-environment ${variables}; ${extraCommands}"''; + dbus = ''exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables}; ${extraCommands}"''; + } + .${cfg.systemd.dbusImplementation}; configFile = pkgs.writeTextFile { name = "sway.conf"; @@ -556,6 +561,23 @@ in ''; }; + dbusImplementation = mkOption { + type = types.enum [ + "dbus" + "broker" + ]; + default = "dbus"; + example = "broker"; + description = '' + The D-Bus implementation used on the system. + This affects which tool is used to import environment variables when starting the Sway session. + On NixOS, this should match the value of the option [`services.dbus.implementation` (NixOS)](https://nixos.org/manual/nixos/stable/options#opt-services.dbus.implementation). + When set to `dbus`, `dbus-update-activation-environment --systemd ` is run. + Otherwise, when set to `broker`, `systemctl --user import-environment ` is run. + See for more documentation. + ''; + }; + extraCommands = mkOption { type = types.listOf types.str; default = [