summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-10-26 10:52:50 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2022-11-12 23:40:20 +0100
commit5f03b6ddfc27a5cb3b5e851a25db3cf1590f6fc0 (patch)
treee1700e6cef19c9d01f6d3490cf22cb06e836db80 /nixos
parenta832695c57f971113cb0b93e1b0022046268b0fe (diff)
nixos/console: move enable option out of let in
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/console.nix18
-rw-r--r--nixos/modules/virtualisation/container-config.nix3
2 files changed, 16 insertions, 5 deletions
diff --git a/nixos/modules/config/console.nix b/nixos/modules/config/console.nix
index 1f8f80a554d0b..f5db5dc5dfc11 100644
--- a/nixos/modules/config/console.nix
+++ b/nixos/modules/config/console.nix
@@ -34,14 +34,16 @@ let
       "/share/unimaps"
     ];
   };
-
-  setVconsole = !config.boot.isContainer;
 in
 
 {
   ###### interface
 
   options.console  = {
+    enable = mkEnableOption (lib.mdDoc "virtual console") // {
+      default = true;
+    };
+
     font = mkOption {
       type = with types; either str path;
       default = "Lat2-Terminus16";
@@ -125,11 +127,17 @@ in
           '');
     }
 
-    (mkIf (!setVconsole) {
-      systemd.services.systemd-vconsole-setup.enable = false;
+    (mkIf (!cfg.enable) {
+      systemd.services = {
+        "serial-getty@ttyS0".enable = false;
+        "serial-getty@hvc0".enable = false;
+        "getty@tty1".enable = false;
+        "autovt@".enable = false;
+        systemd-vconsole-setup.enable = false;
+      };
     })
 
-    (mkIf setVconsole (mkMerge [
+    (mkIf cfg.enable (mkMerge [
       { environment.systemPackages = [ pkgs.kbd ];
 
         # Let systemd-vconsole-setup.service do the work of setting up the
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
index c2e61a77c01ee..09a2d9de040a2 100644
--- a/nixos/modules/virtualisation/container-config.nix
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -7,8 +7,11 @@ with lib;
   config = mkIf config.boot.isContainer {
 
     # Disable some features that are not useful in a container.
+
     boot.kernel.enable = false;
 
+    console.enable = mkDefault false;
+
     nix.optimise.automatic = mkDefault false; # the store is host managed
     powerManagement.enable = mkDefault false;
     documentation.nixos.enable = mkDefault false;