Subject: SDDM does not do the equivalent of 'login shell --login', unlike other login managers

From: Maxime Devos <[email-masked]>
Date: Fri, 22 Jul 2022 15:13:15 +0200

On 22-07-2022 15:03, Andrew Tropin wrote:
> It's a tricky question, because it's a case on the edge of Home/System.
>  From one point of view it should be handled by some home service, which
> will create a proper ~/.xsession or extend it and generic mechanism,
Such a mechanism already exists for GDM and SLiM, see later (though it 
doesn't create ~/.xessionrc, it's more stateless, and it is independent 
of Guix Home). I don't see why Guix Home should handle things, it 
doesn't seem to have anything to handle (unless you go for the 
alternative, more stateful, solution you are proposing?).
> from some display managers will automatically source it, but on the
> other hand maybe adjusting system services for other DMs, which doesn't
> work "out of the box" yet is a way to go.  I don't have much experience
> with X11, and don't see a whole picture, so it's hard to tell which
> option is better.

I think I've found a solution that works for Guix System, independent of 
Guix Home (doesn't depend on Guix Home and doesn't interfere with Guix 
Home and doesn't require Guix System and Guix Home to interact), as 
written in another response (thread is getting a bit long!):

> On 22-07-2022 12:24, Maxime Devos wrote:
>> retitle 56661 SDDM does not do the equivalent of 'login shell 
>> --login', unlike other login managers
>> thanks
>>
>> A digged a little, and found  that:
>>
>> For GDM, things work, for SDDM, they don't.
>>
>> There is a 'xinitrc' procedure in gnu/services/xorg.scm that 
>> generates a configuration file that has a fallback .xsession that 
>> does a --login. This is used by gdm-wayland-session-wrapper, 
>> <gdm-configuration> and slim-shepherd-service.  However, nothing 
>> similar appears to be done for SDDM.  So it appears that the SDDM 
>> service needs to be tweaked to use xinitrc or such.
>
> It appears that SDDM supports xinitrc files, but it looks for them 
> (see data/scripts/Xsession) in $HOME/.xsessionrc and 
> /etc/X11/xinit/xinitrc.d, which do not exist in Guix. There is no 
> option for overriding the xinitrc.  However, it is possible to 
> override the Xsession script used, so we can give SDDM a modified 
> Xsession script that uses Guix' xinitrc. 

TBC: the 'xinitrc' that Guix generates does not override the ~/.xinitrc 
written by the user (if any) -- IIUC, the generated wrapper looks for 
~/.xinitrc and if it exists, it runs that, but if it doesn't exist, it 
has a fallback. Also, TBC, it doesn't create ~/.xsessionrc (unlike what 
you seem to be proposing), the relevant code just tells the login 
manager to look at /gnu/store/...-the-generated-xinitrc.

It seems to work for GDM and presumably also for SLiM, which has similar 
code. As such, I would expect it to work without problems for SDDM as 
well (please write SDDM in the subject line, the original SLiM is 
incorrect, I actually used SDDM).

Greetings,
Maxime