Fatest way to "boot into" a window manager?

I’m trying to build a lean system and thus trying to avoid using any desktop / session / display manager.

Right now, I’m using the agetty autologin + exec river in my shell .profile trick but the tty1 “flashes” for a split second while river is loading.

I wonder if there’s a better / faster way? Maybe using systemd to automatically start the window manager?

Note: I know this isn’t 100% related to NixOS as this also happens on all other distro, but I couldn’t find any ressources, so I figured asking here is as good as any other places.

AFAIK you must go through the whole getty → login → wm sequence in order to run something as your user.

Maybe you could create a fake display manager that runs as root (in order to acquire a screen) and then does setuid or something like that to start river as your user. Try looking into services.displayManager.execCmd.

1 Like

That’d still result in some flashing. gdm/sddm do a fair bit of stuff to achieve a flicker-free handover from plymouth. I don’t think any console DMs support that because passing through the tty requires a cycle of modesetting, you’re probably best off using a real DM’s autologin if you want to avoid that.

If it’s specifically the tty login text you want to avoid, something like greetd might be more your taste, depending on what you consider “lightweight”.

1 Like

Yeah, greetd seems to fit the bill perfectly. Though, using this configuration

services.greetd.enable = true;
services.greetd.settings.default_session.command = "${pkgs.greetd.greetd}/bin/agreety --cmd ${pkgs.bash}/bin/bash";
services.greetd.settings.initial_session.user = username;
services.greetd.settings.initial_session.command = "river > ~/.river.log 2>&1";

the autologin to river works great (aka. without flashing) but when I close river and use the default greeter, my bash prompt is all messed up :thinking:

bash: shopt: progcomp: invalid shell option name

\[\][\[\]zogstrip@framezork:~]$\[\]

Ok, found a fix, replacing ${pkgs.bash} with ${pkgs.bashInteractive}

services.greetd.settings.default_session.command = "${pkgs.greetd.greetd}/bin/agreety --cmd ${pkgs.bashInteractive}/bin/bash";

Thank you @rnhmjoj / @TLATER