diff options
author | Josselin Poiret <dev@jpoiret.xyz> | 2021-10-02 16:51:34 +0000 |
---|---|---|
committer | Mathieu Othacehe <othacehe@gnu.org> | 2021-10-02 17:24:00 +0000 |
commit | db4681a4c17d282a661552f2f57e5c453d02e414 (patch) | |
tree | 876ee44be90f13572f3fbc72896ff6153d25a3b9 | |
parent | 5c3f0c3e03757b6653f4c2386a526a2d9d6532f7 (diff) |
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>
-rw-r--r-- | doc/guix.texi | 4 | ||||
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/gnome.scm | 3 | ||||
-rw-r--r-- | gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch | 35 | ||||
-rw-r--r-- | gnu/services/xorg.scm | 27 |
5 files changed, 67 insertions, 3 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 6d925a44b8..d92c85727b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18309,6 +18309,10 @@ The GDM package to use. @item @code{wayland?} (default: @code{#f}) When true, enables Wayland in GDM, necessary to use Wayland sessions. + +@item @code{wayland-session} (default: @code{gdm-wayland-session-wrapper}) +The Wayland session wrapper to use, needed to setup the +environment. @end table @end deftp diff --git a/gnu/local.mk b/gnu/local.mk index cc2a634d37..07e0785c05 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1102,6 +1102,7 @@ dist_patch_DATA = \ %D%/packages/patches/gdm-default-session.patch \ %D%/packages/patches/gdm-elogind-support.patch \ %D%/packages/patches/gdm-remove-hardcoded-xwayland-path.patch \ + %D%/packages/patches/gdm-wayland-session-wrapper-from-env.patch \ %D%/packages/patches/geary-CVE-2020-24661.patch \ %D%/packages/patches/genimage-signedness.patch \ %D%/packages/patches/geoclue-config.patch \ diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm index f0a8a4265d..c705d68943 100644 --- a/gnu/packages/gnome.scm +++ b/gnu/packages/gnome.scm @@ -8150,7 +8150,8 @@ library.") (search-patches "gdm-default-session.patch" "gdm-elogind-support.patch" - "gdm-remove-hardcoded-xwayland-path.patch")))) + "gdm-remove-hardcoded-xwayland-path.patch" + "gdm-wayland-session-wrapper-from-env.patch")))) (build-system meson-build-system) (arguments `(#:glib-or-gtk? #t diff --git a/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch new file mode 100644 index 0000000000..28d4b5b9fa --- /dev/null +++ b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch @@ -0,0 +1,35 @@ +Get wayland-session wrapper from environment. + +--- + daemon/gdm-session.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c +index 4e303e70..1deca4e9 100644 +--- a/daemon/gdm-session.c ++++ b/daemon/gdm-session.c +@@ -2888,8 +2888,9 @@ gdm_session_start_session (GdmSession *self, + allow_remote_connections? "--allow-remote-connections " : "", + command); + } else { +- program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"", ++ program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s %s\"", + register_session ? "--register-session " : "", ++ g_getenv ("GDM_WAYLAND_SESSION"), + command); + } + } else if (run_xsession_script) { +@@ -2906,8 +2907,9 @@ gdm_session_start_session (GdmSession *self, + register_session ? "--register-session " : "", + self->selected_program); + } else { +- program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"", ++ program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s %s\"", + register_session ? "--register-session " : "", ++ g_getenv ("GDM_WAYLAND_SESSION"), + self->selected_program); + } + } else { +-- +2.33.0 + 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)))) |