Hyprland and services.xserver.displayManager/desktopManager settings

After a default NixOS with Gnome install, services.xserver looks like this:
{
enable = true;
gdm.enable = true;
gnome.enable = true;
};

To enable Hyprland one simply uses “programs.hyprland.enable = true;”.

My question is what changes do I need to make to the services.xserver settings to use Hyprland in place of Gnome?

Hey,
I have the xserver enabled. I don’t know if it is needed but it works for me and it is also because i use lightDM als a login manager. Also all the other dotfiles on github for hyprland enable the xserver.
It could look something like this:

   services.xserver = {
   enable = true;
# if you use a nvidia gpu
   videoDrivers = ["nvidia"];
    # X11 keymap
    layout = "en";
    xkbVariant = "";
# if you want to use lightdm and configure it
 #   displayManager.lightdm = {
 #    background = <path_to_image_file>;
 #     greeters.slick.enable = true;
    };
  };
  programs = {
    hyprland = {
      enable = true;
# for more info take a look at https://wiki.archlinux.org/title/Wayland#Xwayland
      xwayland.enable = true;
    };
};

Thanks for the reply. What did you install initially? Did you start out with Gnome, some other desktop manager, or none? I’m asking because I reinstalled, selected NONE for DM, then when I add the settings for a display and/or desktop manager nothing seems to work. I always go to the text login and certain apps won’t launch (like Jetbrains toolbox).

EDIT: After I started the DM with ‘sudo systemctl start display-manager’ things seem to start working, even after a reboot. Not sure how but whatever works. I’m just using the gdm.enable with desktopManager.gnome.enable = false. I would try lightdm but now that I have it working I don’t think I want to touch it.

glad it works for you
I went for hyprland immediately and installed nixos directly from the written config. This was possible for me because I already had a nixos system on a second laptop running and could easily test the config before deploying it.