summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorLuca Bruno <lucabru@src.gnome.org>2015-06-22 16:08:29 +0000
committerLuca Bruno <lucabru@src.gnome.org>2015-06-22 16:12:20 +0000
commitf00440fac5552b92098c020946a2ac45a2fe613b (patch)
tree843432d68a202decc5aff05b7d135b15899f9232 /nixos
parent7907a8bcba6fe50e1f7fa8f8ee6a98df884031ad (diff)
downloadnixlib-f00440fac5552b92098c020946a2ac45a2fe613b.tar
nixlib-f00440fac5552b92098c020946a2ac45a2fe613b.tar.gz
nixlib-f00440fac5552b92098c020946a2ac45a2fe613b.tar.bz2
nixlib-f00440fac5552b92098c020946a2ac45a2fe613b.tar.lz
nixlib-f00440fac5552b92098c020946a2ac45a2fe613b.tar.xz
nixlib-f00440fac5552b92098c020946a2ac45a2fe613b.tar.zst
nixlib-f00440fac5552b92098c020946a2ac45a2fe613b.zip
nixos/x11: start session with dbus-launch
This is needed by most window managers. Desktop environments
usually launch dbus-launch if a session hasn't been started yet
so this shouldn't hurt. The worst it can happen is that one
dbus session will be unused in case it's started twice.

The GDM change is backported from recent gdm.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/x11/display-managers/default.nix6
-rw-r--r--nixos/modules/services/x11/xserver.nix8
2 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index 736621a14a43..7e05cd84be64 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -50,6 +50,12 @@ let
         exec > ~/.xsession-errors 2>&1
       ''}
 
+      ${optionalString cfg.startDbusSession ''
+        if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
+          exec ${pkgs.dbus.tools}/bin/dbus-launch --exit-with-session "$0" "$sessionType"
+        fi
+      ''}
+
       ${optionalString cfg.displayManager.desktopManagerHandlesLidAndPower ''
         # Stop systemd from handling the power button and lid switch,
         # since presumably the desktop environment will handle these.
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index 9fddc6a72104..1ec098fded6e 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -238,6 +238,14 @@ in
         '';
       };
 
+      startDbusSession = mkOption {
+        type = types.bool;
+        default = true;
+        description = ''
+          Whether to start a new DBus session when you log in with dbus-launch.
+        '';
+      };
+
       layout = mkOption {
         type = types.str;
         default = "us";