From 8cb99658bdedebed049e14bf61a429ce47c273a7 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 31 Jul 2025 08:33:21 -0400 Subject: [PATCH] nixos/display-manager: Disable the dependency on autovt@tty1 rather than masking it --- nixos/modules/services/display-managers/default.nix | 6 ------ nixos/modules/services/ttys/getty.nix | 9 ++++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/display-managers/default.nix b/nixos/modules/services/display-managers/default.nix index 7d518cb501fa..800a10f17d80 100644 --- a/nixos/modules/services/display-managers/default.nix +++ b/nixos/modules/services/display-managers/default.nix @@ -267,12 +267,6 @@ 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 = [ diff --git a/nixos/modules/services/ttys/getty.nix b/nixos/modules/services/ttys/getty.nix index 8fed34e73932..6c9932b15887 100644 --- a/nixos/modules/services/ttys/getty.nix +++ b/nixos/modules/services/ttys/getty.nix @@ -148,7 +148,14 @@ in "container-getty@.service" ]; - systemd.targets.getty.wants = [ "autovt@tty1.service" ]; + # We can't just rely on 'Conflicts=autovt@tty1.service' because + # 'switch-to-configuration switch' will start 'autovt@tty1.service' + # and kill the display manager. + systemd.targets.getty.wants = + lib.mkIf (!(config.systemd.services.display-manager.enable or false)) + [ + "autovt@tty1.service" + ]; systemd.services."getty@" = { serviceConfig.ExecStart = [