Disabling GDM and all login managers

How do I disable GDM (and all GUI login managers) to configure my system to boot to a high res VT CLI with cowsay or a MOTD?

I am prepared to launch my Wayland compositors just by typing: sway, hyprland, wayfire, and gnome-shell.

1 Like

Perhaps in my original question I asked for too many things all at once. Instead of configuring cowsay, MOTD, and a higher resolution, for now first things first: How do I disable GDM so that when NixOS boots the prompt is just a basic CLI login shell?

services.xserver.enable = false;

or just omit services.xserver from your configuration.nix.

to disable gdm just do following in your configuration:

displayManager.gdm.enable = false;

but note that when you disable it you have no lockscreen for gnome.

but if you want a cli login manager you could try ly:

services.displayManager.ly.enable = true;

This changed gdm’s appearance to something that is bare-bones. I rebooted and gdm is still loading.

I intend on using Sway, Wayfire, Hyprland, Gnome Shell, and i3wm - - some of which include and rely on X11 conponents like XWayland so I don’t really want to disable the X server entirely.

I tried this suggestion as well. When I rebooted, a CLI login manager loads but it takes me to an xterm which is not what I want either.

My apologies for the lack of clarity and specificity so far on my part.

To clarify: My goal is to have NixOS boot to a Virtual Terminal (similar to when the Ctrl+Alt+F3 key sequence is invoked and it takes you to the CLI VT login screen) and then once I login, I will just launch my GUI by typing gnome-shell or Hyprland.

So i found out that with the following you boot directly into the tty:

  services.xserver = {
      displayManager = {
        startx.enable = true;
      };
  };

should it bring you to the tty when booted.
I don`t really understand what you mean by CLI VT login screen.
Do you mean this?

1 Like

When I say VT I am not referring to Virus Total. VT in my mind is an acronym for Virtual Terminal or in other words, when a user invokes: Ctrl + Alt + F2/F7/FN. So TTY is actually what I am referring to. You got it.

When I add the above to my configuration.nix and rebuild my system, nixpkgs returns this error:

$ sudo nixos-rebuild --impure switch
error:
       … while calling the 'seq' builtin
         at /nix/store/apfqvr9kddcl6fscjvb92p4xdrqzcwk0-source/lib/modules.nix:334:18:
          333|         options = checked options;
          334|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          335|         _module = checked (config._module);

       … while evaluating a branch condition
         at /nix/store/apfqvr9kddcl6fscjvb92p4xdrqzcwk0-source/lib/modules.nix:273:9:
          272|       checkUnmatched =
          273|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          274|           let

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: syntax error, unexpected IN_KW, expecting end of file
       at /home/evangelist/nixoslaptop-configs/configuration.nix:1:21:
            1|   Help is available in the configuration.nix(5) man page
             |                     ^
            2| # and in the NixOS manual (accessible by running ‘nixos-help’).

Full configuration.nix can be found at this location on my GitHub here:

you need to comment the first line in your configuration. It is uncommented and gets interpreted.
just do the following for the first line of your configuration:

# Help is available in the configuration.nix(5) man page

with the # you comment something.

Yikes! Not sure why the first line in my configuration.nix was uncommented. Perhaps a keystroke error in vim when I modified it last. Anways, I re-commented that line out and it worked. I rebooted and now it boots to TTY. Thank you @Postboote. We are very close now to my end goal.

The only remaining issue is that when I try to run $ gnome-shell from TTY after successfully entering my credentials it says: "Failed to configure: unsupported session type. " The only way to get gnome to start is if I load xterm or some compositor first and then run $ gnome-shell --replace. Any idea what I need to change in my configuration.nix next to get gnome-shell to start?

could you try startx and then gnome-session in the command line

When I run startx an xterm canvas loads. Running $ gnome-shell next launches Gnome. So I guess that works but that involves jumping two hoops instead of one. To run Hyprland or sway I don’t need to start an xterm. They just load directly from the original tty screen.

High res I’ve forgotten how to do. IIRC it’s some kernel module, but I don’t recall explicitly adding anything to my config to make that happen.

But the display managers part is simple. You have to disable GDM, but also disable the de-facto default display manager on NixOS (LightDM).

    services.xserver.displayManager = {
        gdm.enable = false;
        lightdm.enable = false;
    };

You can even go a step further and proactively disable all potential display managers.

  systemd.services.display-manager.enable = false;

Since I believe all DMs on NixOS would use this systemd service. (Or you can set the individual .enables to false to be sure too.)

yeah because hyprland and also sway launch their compositor them self.
Where as on KDE and Gnome the display manager does it.

Ah OK interesting. That makes sense. That is just that way Gnome and KDE/Plasma works. noted