How to enable login screen and start hyperland after login

I installed NixOS without a desktop environment. Then I installed Hyprland by setting programs.hyprland.enable = true;

Now, after the system boots, I have to login in into TTY and then manually start hyprland with command Hyprland.

What configuration am I missing so that a login screen is displayed after boot and after I provide the username&password, I am dropped directly into hyprland desktop?

I’m not sure a display manager is needed but here’s my config that auto starts it:

   services.xserver.enable = true;
   services.xserver.displayManager.sddm.enable = true;
   services.xserver.displayManager.sddm.wayland.enable = true;
   services.xserver.displayManager.sddm.theme = "where_is_my_sddm_theme";

I added where-is-my-sddm-theme to my systemPackages. I followed hyprland quick start advice.

1 Like

Thank you, it works.

I wonder, however, is it really necessary to run the xserver for this is there a wayland login manager?

I found the answer here using greetd/tuigreet: https://github.com/sjcobb2022/nixos-config/blob/29077cee1fc82c5296908f0594e28276dacbe0b0/hosts/common/optional/greetd.nix

1 Like

sddm has experimental wayland support, as @rjpc configures.

Gdm also supports wayland, and greetd is an option too indeed.

Yes, I wondered that myself and played around with disabling and enabling xserver and it seemed having it enabled was required (a bit counter intuitive, for sure); nice find with greetd!

Hum, I used greetd.gtkgreet on hyprland before I switched to sway and it worked fine. I don’t think an Xorg login manager is required?

2 Likes

I think the easiest way would be to create some sort of startup shell script or a systemd service that starts on login.

https://nixos.wiki/wiki/Extend_NixOS

This forum post might be helpful as well.
https://www.reddit.com/r/NixOS/comments/w0rsxi/comment/igg8bvw/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

Yeah, I think xserver might just be needed for sddm? :confused:

I think OP just wants hyprland to autostart on login through the tty. They don’t need a full fat display manager, if I am interpreting correctly.

1 Like

I thought so at first but re-reading it OP asks

[what] am I missing so that a login screen is displayed after boot and after I provide the username&password I am dropped directly into hyprland desktop

They found https://github.com/NixOS/nixpkgs/blob/b0b2c5445c64191fd8d0b31f2b1a34e45a64547d/nixos/modules/services/display-managers/greetd.nix which doesn’t require xserver nonsense.

1 Like

I see; my bad. If this issue is solved, can @djelenc mark the solution?