summary refs log tree commit diff
path: root/gnu/services/xorg.scm
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2021-10-02 16:51:34 +0000
committerMathieu Othacehe <othacehe@gnu.org>2021-10-02 17:24:00 +0000
commitdb4681a4c17d282a661552f2f57e5c453d02e414 (patch)
tree876ee44be90f13572f3fbc72896ff6153d25a3b9 /gnu/services/xorg.scm
parent5c3f0c3e03757b6653f4c2386a526a2d9d6532f7 (diff)
downloadguix-db4681a4c17d282a661552f2f57e5c453d02e414.tar.gz
services: gdm: Add Wayland support.
* gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/gnome.scm (gdm): Use it.
* gnu/services/xorg.scm (<gdm-configuration>)[wayland-session]: New field.
(gdm-wayland-session-wrapper): New procedure.
(gdm-configuration-file): Point to this new procedure.
* doc/guix.texi (X Window): Update it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
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))))