summary refs log tree commit diff
path: root/nixos/modules/tasks/kbd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/tasks/kbd.nix')
-rw-r--r--nixos/modules/tasks/kbd.nix21
1 files changed, 13 insertions, 8 deletions
diff --git a/nixos/modules/tasks/kbd.nix b/nixos/modules/tasks/kbd.nix
index e001832ec2eb5..3975dd5b0ffd9 100644
--- a/nixos/modules/tasks/kbd.nix
+++ b/nixos/modules/tasks/kbd.nix
@@ -71,7 +71,7 @@ in
   ###### implementation
 
   config = mkMerge [
-    (mkIf (!setVconsole || (setVconsole && config.boot.earlyVconsoleSetup)) {
+    (mkIf (!setVconsole) {
       systemd.services."systemd-vconsole-setup".enable = false;
     })
 
@@ -97,20 +97,25 @@ in
             printf "${makeColorCS n color}" >> /dev/console
           '') config.i18n.consoleColors}
         '';
-      }
 
-      (mkIf (!config.boot.earlyVconsoleSetup) {
-        # This is identical to the systemd-vconsole-setup.service unit
-        # shipped with systemd, except that it uses /dev/tty1 instead of
-        # /dev/tty0 to prevent putting the X server in non-raw mode, and
-        # it has a restart trigger.
+        /* XXX: systemd-vconsole-setup needs a "main" terminal. By default
+         * /dev/tty0 is used which wouldn't work when the service is restarted
+         * from X11. We set this to /dev/tty1; not ideal because it may also be
+         * owned by X11 or something else.
+         *
+         * See #22470.
+         */
         systemd.services."systemd-vconsole-setup" =
           { wantedBy = [ "sysinit.target" ];
             before = [ "display-manager.service" ];
             after = [ "systemd-udev-settle.service" ];
             restartTriggers = [ vconsoleConf kbdEnv ];
+            serviceConfig.ExecStart = [
+              ""
+              "${pkgs.systemd}/lib/systemd/systemd-vconsole-setup /dev/tty1"
+            ];
           };
-      })
+      }
 
       (mkIf config.boot.earlyVconsoleSetup {
         boot.initrd.extraUtilsCommands = ''