NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.54k forks source link

Setting `xserver.autorun` to false no longer prevents a display manager from starting #311683

Closed immindich closed 3 weeks ago

immindich commented 3 months ago

Describe the bug

In stable, setting services.xserver.autorun = false in my NixOS config prevented my display manager from starting automatically. I could then start the display manager manually by running systemctl start display-manager.service. I just upgraded to unstable and this no longer works. I think this may be because of this line in the xserver module.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Include the following in your NixOS config:
    services.xserver = {
    enable = true;
    autorun = false;
    };
  2. Rebuild and reboot. A display manager will automatically start. If no display manager is explicitly enabled, this will be LightDM.

Expected behavior

System boots to the console.

Notify maintainers

@SuperSandro2000

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.30, NixOS, 24.05 (Uakari), 24.05pre623656.f1010e0469db`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"home-manager, nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

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

SuperSandro2000 commented 3 months ago

This is probably because of https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/graphical-desktop.nix#L45 which is required for SDDM on Wayland where no xserver is started at all. The easiest fix is probably to set systemd.defaultUnit to multi-user.target.

SuperSandro2000 commented 3 weeks ago

Going to close this as won't fix. If you want to prevent a Wayland display manager from starting up, please change systemd.defaultUnit