Subject: Re: bug#50563: [PATCH [0/2] gnu: GDM: Add Wayland support

From: Josselin Poiret <[email-masked]>
Date: Fri, 01 Oct 2021 08:56:21 +0000

Hello,

On Friday, October 1st, 2021 at 9:37 AM, Mathieu Othacehe <[email-masked]> wrote:
> I'm not sure to get perfectly the role of this wrapper, could you
> please clarify it?

Simply put, when display managers (on Guix) start an X session, they are all configured to use a generic Guix-specific wrapper script, a `xinitrc`.
This feature predates Guix of course, and is supported by all display managers afaik. `xinitrc` is defined in `gnu/services/xorg.scm` and is the generic Guix wrapper.
Notice that most importantly, it runs the window manager inside a login shell, which thus inherits the right environment variables that are set by default in `/etc/profile` (unless of course `/etc/profile` isn't sourced by the login shell, but then the user is on his own).

So we would like to do the same with Wayland, however since Wayland compositors are just single programs that need to be launched, most display managers used to simply start the compositors without doing anything else. This is still the behaviour of GDM, whereas for example SDDM or Slim (at least in Guix) already support wrapping those in some scripts. Here, I just define a generic script that launches sessions inside a login shell, akin to the default `xinitrc`. The check for the `gdm` user is that the GDM graphical display is launched through... GDM itself, and thus is handled like the other Wayland sessions; but since the `gdm` user doesn't have a login shell, this wouldn't work.

> It looks like nix is dealing differently with the session starting,
> without using a dedicated script:
> https://github.com/NixOS/nixpkgs/blob/master/pkgs/desktops/gnome/core/gdm/fix-paths.patch

>From my understanding of https://github.com/NixOS/nixpkgs/issues/109546, they're still trying to deal with this generic issue (ie. they haven't patched in wrapper support in GDM).
See https://github.com/NixOS/nixpkgs/issues/109542 for an example of a bug that stems from it.

Josselin