summary refs log tree commit diff
path: root/nixos/modules/tasks/kbd.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-02-09 03:00:53 +0300
committerNikolay Amiantov <ab@fmap.me>2016-02-10 13:38:27 +0300
commit7ab80e8f79beacfcc5361ef037bc63e6a30a39be (patch)
tree0ce5889fdec875d9cdee3769c6479947d946dbce /nixos/modules/tasks/kbd.nix
parent0024c10a5c974ee41c7bc69cd61faaa920f3a9d4 (diff)
downloadnixlib-7ab80e8f79beacfcc5361ef037bc63e6a30a39be.tar
nixlib-7ab80e8f79beacfcc5361ef037bc63e6a30a39be.tar.gz
nixlib-7ab80e8f79beacfcc5361ef037bc63e6a30a39be.tar.bz2
nixlib-7ab80e8f79beacfcc5361ef037bc63e6a30a39be.tar.lz
nixlib-7ab80e8f79beacfcc5361ef037bc63e6a30a39be.tar.xz
nixlib-7ab80e8f79beacfcc5361ef037bc63e6a30a39be.tar.zst
nixlib-7ab80e8f79beacfcc5361ef037bc63e6a30a39be.zip
kbd module: don't setup vconsoles if we are in a container
Diffstat (limited to 'nixos/modules/tasks/kbd.nix')
-rw-r--r--nixos/modules/tasks/kbd.nix51
1 files changed, 30 insertions, 21 deletions
diff --git a/nixos/modules/tasks/kbd.nix b/nixos/modules/tasks/kbd.nix
index e1574fa68ad9..02721bb3bea2 100644
--- a/nixos/modules/tasks/kbd.nix
+++ b/nixos/modules/tasks/kbd.nix
@@ -12,6 +12,8 @@ let
     FONT=${config.i18n.consoleFont}
     ${colors}
   '';
+
+  setVconsole = !config.boot.isContainer;
 in
 
 {
@@ -41,26 +43,33 @@ in
 
   ###### implementation
 
-  config = {
-
-    environment.systemPackages = [ pkgs.kbd ];
-
-    # Let systemd-vconsole-setup.service do the work of setting up the
-    # virtual consoles.  FIXME: trigger a restart of
-    # systemd-vconsole-setup.service if /etc/vconsole.conf changes.
-    environment.etc."vconsole.conf".source = vconsoleConf;
-
-    # 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.
-    systemd.services."systemd-vconsole-setup" =
-      { wantedBy = [ "multi-user.target" ];
-        before = [ "display-manager.service" ];
-        after = [ "systemd-udev-settle.service" ];
-        restartTriggers = [ vconsoleConf ];
-      };
-
-  };
+  config = mkMerge [
+    (mkIf (!setVconsole) {
+      systemd.services."systemd-vconsole-setup".enable = false;
+    })
+
+    (mkIf setVconsole {
+      environment.systemPackages = [ pkgs.kbd ];
+
+      # Let systemd-vconsole-setup.service do the work of setting up the
+      # virtual consoles.  FIXME: trigger a restart of
+      # systemd-vconsole-setup.service if /etc/vconsole.conf changes.
+      environment.etc = [ {
+        target = "vconsole.conf";
+        source = vconsoleConf;
+      } ];
+
+      # 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.
+      systemd.services."systemd-vconsole-setup" =
+        { wantedBy = [ "multi-user.target" ];
+          before = [ "display-manager.service" ];
+          after = [ "systemd-udev-settle.service" ];
+          restartTriggers = [ vconsoleConf ];
+        };
+    })
+  ];
 
 }