NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.37k stars 13.59k forks source link

services.displayManager.defaultSession does not work with gdm when using hyprland or sway #334404

Open forest-cat opened 1 month ago

forest-cat commented 1 month ago

Describe the bug

A clear and concise description of what the bug is. When using gdm as your displayManager and configuring autologin with hyprland or sway via the nixos option it does not start the hyprland or sway session and instead switches to xfce which i have installed too.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Have Xfce and hyprland or sway enabled
  2. Enable gdm as your displayManager
  3. Enable Autologin for your preferred user via the autoLogin nixos option
  4. Set the defaultSession to "hyprland" or "sway"
  5. Reboot

Expected behavior

A clear and concise description of what you expected to happen. The displayManager (gdm) should automatically log me into my hyprland or sway desktop

Additional context

Add any other context about the problem here. Some parts of my configuration.nix

services.displayManager = {
    defaultSession = "hyprland";
      autoLogin = {
          enable = true;
          user = "<username>";
      };
  };
  services.xserver.displayManager.gdm = {
    enable = true;
    settings = {
      greeter = {
        IncludeAll = true;
      };
    };
  };

  # Hyperland
  programs.hyprland = {
    enable = true;
    xwayland.enable = true;
  };

Notify maintainers

@stuebinm -Last change @bobby285271 -Gnome Team @hedning -Gnome Team @jtojnar -Gnome Team @dasj19 -Gnome Team

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.43, NixOS, 24.05 (Uakari), 24.05.20240801.0540572`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos-23.11"`
 - nixpkgs: `/nix/store/0ma1jl6szmcx4pr9vsczrn7vw7f85b08-source`

Add a :+1: reaction to issues you find important.

sliedes commented 3 weeks ago

For me it starts Hyprland (as I want), but then after a few seconds it somehow gets replaced by gnome (which I don't want).

  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;
  services.displayManager.defaultSession = "hyprland";
Atemu commented 3 weeks ago

Make sure GDM and hyprland are built from the same revision of Nixpkgs. GDM will not consider desktop entries that it cannot start due to i.e. a mesa version mismatch and start the next desktop session in the list that it is able to start. If there are no other sessions, it will segfault.

If you nixos-rebuild swtich or test, it can happen that the desktops are updated but an old version of GDM is still running that is built against an older Mesa (it does not get restarted during activation in order to not kill your session).

It's also common for people to be using desktop sessions from home-manager, neglecting to update it at the same time as their NixOS.

If a staging-next merge happened in your channel update, you should ideally nixos-rebuild boot and then reboot rather than switching in order to avoid issues like this.

sliedes commented 3 weeks ago

For me at least this happens immediately at reboot time. My hyprland packages are also system-wide and from the same nixpkgs (though I'm surprised differing mesa versions are a problem—so does GDM do something else than just exec the binary?). Moreover, Hyprland does start, but so does GNOME.

forest-cat commented 3 weeks ago

Same here, GDM and Hyprland/Sway all are built from the same nixpkgs source. Im not using home-manager for any desktop related settings and my home-manager is managed via the same flake. For me it also happens on reboot