summary refs log tree commit diff
path: root/nixos/modules/services/ttys
diff options
context:
space:
mode:
authorPetr Rockai <me@mornfall.net>2014-02-03 23:20:41 +0100
committerPetr Rockai <me@mornfall.net>2014-02-15 12:57:27 +0100
commit01d7e79eafc48c92997e5cd3d5e60d5706279bb4 (patch)
treeee3f95c04722179ff92c1283ca31f2a76a07bca1 /nixos/modules/services/ttys
parent97721af469383c389960a8a8a8e6b880ca9bdc84 (diff)
downloadnixlib-01d7e79eafc48c92997e5cd3d5e60d5706279bb4.tar
nixlib-01d7e79eafc48c92997e5cd3d5e60d5706279bb4.tar.gz
nixlib-01d7e79eafc48c92997e5cd3d5e60d5706279bb4.tar.bz2
nixlib-01d7e79eafc48c92997e5cd3d5e60d5706279bb4.tar.lz
nixlib-01d7e79eafc48c92997e5cd3d5e60d5706279bb4.tar.xz
nixlib-01d7e79eafc48c92997e5cd3d5e60d5706279bb4.tar.zst
nixlib-01d7e79eafc48c92997e5cd3d5e60d5706279bb4.zip
nixos: Make serial agetty's bitrates configurable.
Diffstat (limited to 'nixos/modules/services/ttys')
-rw-r--r--nixos/modules/services/ttys/agetty.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix
index ae4fa87d4b7b..211008fa7e41 100644
--- a/nixos/modules/services/ttys/agetty.nix
+++ b/nixos/modules/services/ttys/agetty.nix
@@ -28,6 +28,17 @@ with pkgs.lib;
         '';
       };
 
+      serialSpeed = mkOption {
+        type = types.listOf types.int;
+        default = [ 115200 57600 38400 9600 ];
+        example = [ 38400 9600 ];
+        description = ''
+            Bitrates to allow for agetty's listening on serial ports. Listing more
+            bitrates gives more interoperability but at the cost of long delays
+            for getting a sync on the line.
+        '';
+      };
+
     };
 
   };
@@ -78,8 +89,9 @@ with pkgs.lib;
         X-RestartIfChanged=false
       '';
     
-    systemd.units."serial-getty@.service".text =
-      ''
+    systemd.units."serial-getty@.service".text = let
+        speeds = with pkgs.lib; concatStringsSep "," (map toString config.services.mingetty.serialSpeed);
+      in ''
         [Unit]
         Description=Serial Getty on %I
         Documentation=man:agetty(8) man:systemd-getty-generator(8)
@@ -95,7 +107,7 @@ with pkgs.lib;
         [Service]
         Environment=TERM=linux
         Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
-        ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I 115200,57600,38400,9600
+        ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I ${speeds}
         Type=idle
         Restart=always
         RestartSec=0