Source ~/.profile with GDM and sway

I just migrated from Xorg/i3 to Wayland/sway. When starting an i3 session, GDM sources ~/.xprofile which in my case contained a line source ~/.profile to load my environment.
Now in sway I want to source ~/.profile directly when a sway session is started. I tried using programs.sway.extraSessionCommands as proposed in this comment by GH user xunam, but it looks like extraSessionCommands aren’t executed when I start a sway session.

Did someone manage to run some session setup commands like sourcing ~/.profile when starting a sway session?

My problem was that I included pkgs.sway in environment.systemPackages. This didn’t receive the extraSessionCommand parameter, and the unmodified sway package probably masked the modified one. Removing pkgs.sway from environment.systemPackages helped.

2 Likes