SystemD user services fail to run on login

wow I was “sure” that sway and NixOS support of it would be really good given the years sway has been around and how hacky the nixos users should be. Guess I was wrong! (I was on Manjaro + Plasma 5 with i3 for the past 4+ years)

I’ll give a go at your script and report back

thank you!

I worked around the problem by using agetty auto-login. I have screen flicker during boot but I get a totally working sway in return (I’d really like my boot process to not flicker during systemd-boot → plymouth → sway)

My configuration:

NixOS (e.g. configuration.nix):

  systemd.services."getty@tty1" = {
    overrideStrategy = "asDropin";
    serviceConfig.ExecStart = ["" "@${pkgs.util-linux}/sbin/agetty agetty --login-program ${config.services.getty.loginProgram} --autologin dzervas --noclear --keep-baud %I 115200,38400,9600 $TERM"];
  };

Home-manager (login shell):

  programs.fish = {
    loginShellInit = ''
      if test -z "$WAYLAND_DISPLAY" -a "$XDG_VTNR" -eq 1
        exec sway
      end
    '';
  };

note to everyone else copy-pasting the above: Please make sure that you lock the session using the locker you use (e.g. swaylock) during start