nixos/display-managers: tty1 everywhere

This commit is contained in:
Will Fancher 2025-07-24 21:52:43 -04:00
parent f8929b7381
commit 431a976182
10 changed files with 40 additions and 47 deletions

View File

@ -54,6 +54,8 @@
- `go-mockery` has been updated to v3. For migration instructions see the [upstream documentation](https://vektra.github.io/mockery/latest/v3/). If v2 is still required `go-mockery_v2` has been added but will be removed on or before 2029-12-31 in-line with it's [upstream support lifecycle](https://vektra.github.io/mockery/
- NixOS display manager modules now strictly use tty1, where many of them previously used tty7. Options to configure display managers' VT have been dropped. A configuration with a display manager enabled will not start `getty@tty1.service`, even if the system is forced to boot into `multi-user.target` instead of `graphical.target`.
## Other Notable Changes {#sec-nixpkgs-release-25.11-notable-changes}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

View File

@ -267,12 +267,22 @@ in
in
lib.mkIf noDmUsed (lib.mkDefault false);
# We can't just rely on 'Conflicts=autovt@tty1.service' because
# 'switch-to-configuration switch' will start 'autovt@tty1.service'
# and kill us.
systemd.services."autovt@tty1".enable =
lib.mkIf config.systemd.services.display-manager.enable false;
systemd.services.display-manager = {
description = "Display Manager";
after = [
"acpid.service"
"systemd-logind.service"
"systemd-user-sessions.service"
"autovt@tty1.service"
];
conflicts = [
"autovt@tty1.service"
];
restartIfChanged = false;

View File

@ -259,12 +259,10 @@ in
"rc-local.service"
"systemd-machined.service"
"systemd-user-sessions.service"
"getty@tty${gdm.initialVT}.service"
"plymouth-quit.service"
"plymouth-start.service"
];
systemd.services.display-manager.conflicts = [
"getty@tty${gdm.initialVT}.service"
"plymouth-quit.service"
];
systemd.services.display-manager.onFailure = [

View File

@ -6,10 +6,18 @@
}:
let
cfg = config.services.greetd;
tty = "tty${toString cfg.vt}";
tty = "tty1";
settingsFormat = pkgs.formats.toml { };
in
{
imports = [
(lib.mkRemovedOptionModule [
"services"
"greetd"
"vt"
] "The VT is now fixed to VT1.")
];
options.services.greetd = {
enable = lib.mkEnableOption "greetd, a minimal and flexible login manager daemon";
@ -41,14 +49,6 @@ in
'';
};
vt = lib.mkOption {
type = lib.types.int;
default = 1;
description = ''
The virtual console (tty) that greetd should use. This option also disables getty on that tty.
'';
};
restart = lib.mkOption {
type = lib.types.bool;
default = !(cfg.settings ? initial_session);
@ -62,7 +62,7 @@ in
};
config = lib.mkIf cfg.enable {
services.greetd.settings.terminal.vt = lib.mkDefault cfg.vt;
services.greetd.settings.terminal.vt = 1;
services.greetd.settings.default_session.user = lib.mkDefault "greeter";
security.pam.services.greetd = {

View File

@ -9,6 +9,15 @@ let
settingsFormat = pkgs.formats.toml { };
in
{
imports = [
(lib.mkRemovedOptionModule [
"services"
"displayManager"
"lemurs"
"vt"
] "The VT is now fixed to VT1.")
];
options.services.displayManager.lemurs = {
enable = lib.mkEnableOption "" // {
description = ''
@ -36,14 +45,6 @@ in
See [lemurs configuration documentation](https://github.com/coastalwhite/lemurs/blob/main/extra/config.toml) for available options.
'';
};
vt = lib.mkOption {
type = lib.types.ints.positive;
default = 2;
description = ''
The virtual console (tty) that lemurs should use.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
@ -82,7 +83,7 @@ in
desktops = config.services.displayManager.sessionData.desktops;
in
{
tty = lib.mkDefault cfg.vt;
tty = 1;
system_shell = lib.mkDefault "${pkgs.bash}/bin/bash";
initial_path = lib.mkDefault "/run/current-system/sw/bin";
x11 = {
@ -101,16 +102,14 @@ in
Wants = [ "systemd-user-sessions.service" ];
After = [
"systemd-user-sessions.service"
"getty@tty${toString cfg.vt}.service"
"plymouth-quit-wait.service"
];
Conflicts = [ "getty@tty${toString cfg.vt}.service" ];
};
serviceConfig = {
Type = "idle";
# Defaults from lemurs upstream configuration
StandardInput = "tty";
TTYPath = "/dev/tty${toString cfg.vt}";
TTYPath = "/dev/tty1";
TTYReset = "yes";
TTYVHangup = "yes";
# Clear the console before starting

View File

@ -36,7 +36,6 @@ let
defaultConfig = {
shutdown_cmd = "/run/current-system/systemd/bin/systemctl poweroff";
restart_cmd = "/run/current-system/systemd/bin/systemctl reboot";
tty = 2;
service_name = "ly";
path = "/run/current-system/sw/bin";
term_reset_cmd = "${pkgs.ncurses}/bin/tput reset";
@ -115,6 +114,10 @@ in
displayManager = {
enable = true;
execCmd = "exec /run/current-system/sw/bin/ly";
# Set this here instead of 'defaultConfig' so users get eval
# errors when they change it.
ly.settings.tty = 1;
};
xserver = {
@ -130,11 +133,8 @@ in
after = [
"systemd-user-sessions.service"
"plymouth-quit-wait.service"
"getty@tty${toString finalConfig.tty}.service"
];
conflicts = [ "getty@tty7.service" ];
serviceConfig = {
Type = "idle";
StandardInput = "tty";

View File

@ -430,13 +430,9 @@ in
services.display-manager = {
after = [
"systemd-user-sessions.service"
"getty@tty7.service"
"plymouth-quit.service"
"systemd-logind.service"
];
conflicts = [
"getty@tty7.service"
];
};
};
};

View File

@ -42,6 +42,7 @@ let
lightdmConf = writeText "lightdm.conf" ''
[LightDM]
minimum-vt = 1
${optionalString cfg.greeter.enable ''
greeter-user = ${config.users.users.lightdm.name}
greeters-directory = ${cfg.greeter.package}
@ -234,19 +235,11 @@ in
exec ${lightdm}/sbin/lightdm
'';
# Replaces getty
systemd.services.display-manager.conflicts = [
"getty@tty7.service"
# TODO: Add "plymouth-quit.service" so LightDM can control when plymouth
# quits. Currently this breaks switching to configurations with plymouth.
];
# Pull in dependencies of services we replace.
systemd.services.display-manager.after = [
"rc-local.service"
"systemd-machined.service"
"systemd-user-sessions.service"
"getty@tty7.service"
"user.slice"
];

View File

@ -72,9 +72,7 @@ stdenv.mkDerivation (finalAttrs: {
"-DUID_MIN=1000"
"-DUID_MAX=29999"
# we still want to run the DM on VT 7 for the time being, as 1-6 are
# occupied by getties by default
"-DSDDM_INITIAL_VT=7"
"-DSDDM_INITIAL_VT=1"
"-DQT_IMPORTS_DIR=${placeholder "out"}/${qtbase.qtQmlPrefix}"
"-DCMAKE_INSTALL_SYSCONFDIR=${placeholder "out"}/etc"

View File

@ -59,7 +59,7 @@ stdenv.mkDerivation (finalAttrs: {
mesonFlags = [
"-Dgdm-xsession=true"
# TODO: Setup a default-path? https://gitlab.gnome.org/GNOME/gdm/-/blob/6fc40ac6aa37c8ad87c32f0b1a5d813d34bf7770/meson_options.txt#L6
"-Dinitial-vt=${finalAttrs.passthru.initialVT}"
"-Dinitial-vt=1"
"-Dudev-dir=${placeholder "out"}/lib/udev/rules.d"
"-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
"-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user"
@ -185,9 +185,6 @@ stdenv.mkDerivation (finalAttrs: {
passthru = {
updateScript = gnome.updateScript { packageName = "gdm"; };
# Used in GDM NixOS module
# Don't remove.
initialVT = "7";
dconfDb = "${finalAttrs.finalPackage}/share/gdm/greeter-dconf-defaults";
dconfProfile = "user-db:user\nfile-db:${finalAttrs.passthru.dconfDb}";