Wayland sessions

How do I configure a wayland session for Sway or Enlightenment?
I noticed the Oct 2018 message, but hoped it wasn’t still in unstable anymore?
I’m very very new to nixos, but the idea is great and I want to play with it more.
Thanks
Danny

The last time I checked, sway doesn’t integrate with GDM or other session managers.

What I do is log into the console and then run exec sway.

I can try that :wink: I’ve used sway with sddm on other distros. Before I reboot back in Nixos, I’ll validate that (and make sure my mind isn’t playing tricks on me).

According to the Arch Wiki it’s possible to make it work with GDM3 and SDDM. It’s mainly an issue of aligning all of the bits together.

The main issue is that the nixos module for the display managers is tied to the xserver, it hasn’t really been designed with wayland in mind. I don’t know all of the details so you would have to dig in there. The nixpkgs sway package has a share/wayland-sessions/sway.desktop, the issue is to patch the GDM3 / SDDM config for it to look in the right place.

That’s kinda of what I thought looking around. It might pay for it to move in that direction, as Wayland is probably the next big thing with Gnome and KDE moving more and more in that direction.
My opinion right now, is Wayland is not production ready…but getting there pretty quickly.

GDM supports launching wayland sessions and SDDM too (though I haven’t tested that in a while). Adding sway to services.xserver.displayManager.extraSessionFilePackages should probably work out of the box (that makes GDM et.al. aware of relevant .desktop session files in the package). This how we do it in gnome.

There’s a PR for pasma Plasma5: Use upstream xsession/wayland-session files by bkchr · Pull Request #56988 · NixOS/nixpkgs · GitHub, which is blocked on getting SDDM to select a known default session when building the system (GDM never supported that). I’ve made an attempt to fix the default session issue here: nixos/displayManager: introduce defaultSession by hedning · Pull Request #53843 · NixOS/nixpkgs · GitHub

In short as @zimbatm said, there’s a bunch of assumptions built into the whole desktop/display manager system which we don’t want to just break.

Oh, I’m not saying just because I want it. Just that I think it will increase in importance soon. Of course that will probably require some upstream changes too.
I’m well capable of adjusting things in config files by hand. I only opened topic to know if there was a Nix was of doing it yet :slight_smile:

I’d like to see, as so far I open a tty session (CTRL+ALT+F3) and launch sway from there.

I’ll try the alternative of starting a xterm session and launch sway as @zimbatm wrote.

Can someone with more experience give us a taste of just how entangled xserver and the current DEs are?

I don’t mind startying Sway from TTY, but between my EFI boot menu, systemd-boot, LUKS decrypt, boot, TTY login, start sway… I’m starting to wish my boot were faster and more seamless and am considering trying to get Sway+some_login_manager working.

I also think this work is probably important for NixOS going forward. It’s an unpopular opinion but Wayland is the future and it seems like even the smaller DEs are working on native Wayland support, so we should start trying to figure out what to do in NixOS to support Wayland sessions well.

I’m currently using sddm in case I want to switch between X+i3 and sway. I only needed to add swayJoined from modules/programs/sway.nix to the mentioned displayManager.extraSessionFilePackages.

2 Likes

In case this helps anyone else, I stumbled on this thread recently (July 2023) trying to run a sway session from GDM. The previously mentioned option:

didn’t work on my system because the option has been renamed.

Instead, I was able to get things working by using:

services.xserver.displayManager.sessionPackages = [ pkgs.sway ];