summary refs log tree commit diff
path: root/gnu/services/xorg.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/services/xorg.scm')
-rw-r--r--gnu/services/xorg.scm27
1 files changed, 25 insertions, 2 deletions
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 30b261453b..a3ae578af8 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -870,6 +870,24 @@ the GNOME desktop environment.")
        (apply execl (string-append #$dbus "/bin/dbus-daemon")
               (program-arguments)))))
 
+;; Wrapper script for Wayland sessions, similar to Xsession.
+;;
+;; See `xinitrc`.  By default, it launches the specified session through a
+;; login shell.  With the default Guix configuration, this should source
+;; /etc/profile, setting up the Guix profile environment variables.  However,
+;; gdm launches its own graphical session through the same method, so we need
+;; to ignore this case, since `gdm` doesn't have a login shell.
+(define gdm-wayland-session-wrapper
+  (program-file
+   "gdm-wayland-session-wrapper"
+   #~((let* ((user (getpw (getuid)))
+	    (name (passwd:name user))
+	    (shell (passwd:shell user))
+	    (args (cdr (command-line))))
+        (if (string=? name "gdm")
+	    (apply execl (cons (car args) args))
+	    (execl shell shell "--login" "-c" (string-join args)))))))
+
 (define-record-type* <gdm-configuration>
   gdm-configuration make-gdm-configuration
   gdm-configuration?
@@ -885,7 +903,9 @@ the GNOME desktop environment.")
                       (default (xorg-configuration)))
   (x-session gdm-configuration-x-session
              (default (xinitrc)))
-  (wayland? gdm-configuration-wayland? (default #f)))
+  (wayland? gdm-configuration-wayland? (default #f))
+  (wayland-session gdm-configuration-wayland-session
+                   (default gdm-wayland-session-wrapper)))
 
 (define (gdm-configuration-file config)
   (mixed-text-file "gdm-custom.conf"
@@ -983,7 +1003,10 @@ the GNOME desktop environment.")
                            ;; Add XCURSOR_PATH so that mutter can find its
                            ;; cursors.  gdm doesn't login so doesn't source
                            ;; the corresponding line in /etc/profile.
-                           "XCURSOR_PATH=/run/current-system/profile/share/icons"))))
+                           "XCURSOR_PATH=/run/current-system/profile/share/icons"
+                           (string-append
+                            "GDM_WAYLAND_SESSION="
+                            #$(gdm-configuration-wayland-session config))))))
          (stop #~(make-kill-destructor))
          (respawn? #t))))