Home-manager xsession.windowManager.command (~/.xsession) ignored by gdm

I have a bunch of issues with GDM.

I have set my default desktop session to KDE (Mainly that my wife will get the right default)

  services.xserver = {
    enable = true;
    displayManager = {
      defaultSession = "plasmawayland";
      gdm = {
        enable = true;
        wayland = true;

GDM is supposed to remember a users session choice. But that information does not survive a reboot. So GDM will always default back to KDE even for me.

I had a quick look, it seems like GDM is sourcing xsession files

see /etc/gdm/Xsession

# Allow the user to setup a custom session type.
if test -x ~/.xsession; then
    eval exec ~/.xsession "$@"

So the solution seemed obvious. I use home-manager to set
xsession.windowManager.command = "exec Hyprland";

I get a nice ~/.xsession file. But my default desktop session is still KDE.

Interesting observation. Here is where GDM stores the information on the users default session



This file is modified at reboot! No idea by what.

But this is clearly why GDM doesn’t remember my choice

That is what the defaultSession option does:

1 Like

Oh, I see. That’s a very odd definition of default. But I see at least why that’s happening now.

Meanwhile I was playing around with greetd and regreet. But that integration is quite a mess. Especially around Wayland.
I will be glad to return to GDM to be honest.