2014-04-14 16:26:48 +02:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
2009-03-06 13:27:15 +01:00
|
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
|
with lib;
|
2009-07-16 15:55:11 +02:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
###### interface
|
2009-03-06 13:27:15 +01:00
|
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
2009-07-16 15:55:11 +02:00
|
|
|
|
services.mingetty = {
|
|
|
|
|
|
|
|
|
|
greetingLine = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.str;
|
2012-06-07 01:14:57 +02:00
|
|
|
|
default = ''<<< Welcome to NixOS ${config.system.nixosVersion} (\m) - \l >>>'';
|
2009-07-16 15:55:11 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Welcome line printed by mingetty.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-03-06 13:27:15 +01:00
|
|
|
|
|
2009-07-16 15:55:11 +02:00
|
|
|
|
helpLine = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2009-07-16 15:55:11 +02:00
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
2012-06-18 23:58:31 +02:00
|
|
|
|
Help line printed by mingetty below the welcome line.
|
2009-07-16 15:55:11 +02:00
|
|
|
|
Used by the installation CD to give some hints on
|
|
|
|
|
how to proceed.
|
|
|
|
|
'';
|
2009-03-06 13:27:15 +01:00
|
|
|
|
};
|
2009-07-16 15:55:11 +02:00
|
|
|
|
|
2014-02-03 23:20:41 +01:00
|
|
|
|
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.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-03-06 13:27:15 +01:00
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
2009-03-06 13:27:15 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2009-07-16 15:55:11 +02:00
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
2014-03-12 18:29:06 +01:00
|
|
|
|
systemd.services."getty@" =
|
2014-04-17 18:52:31 +02:00
|
|
|
|
{ serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login --keep-baud %I 115200,38400,9600 $TERM";
|
2014-03-12 18:29:06 +01:00
|
|
|
|
restartIfChanged = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
systemd.services."serial-getty@" =
|
2014-04-17 18:52:31 +02:00
|
|
|
|
{ serviceConfig.ExecStart =
|
2014-03-12 18:29:06 +01:00
|
|
|
|
let speeds = concatStringsSep "," (map toString config.services.mingetty.serialSpeed);
|
2014-04-16 16:10:11 +02:00
|
|
|
|
in "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I ${speeds} $TERM";
|
|
|
|
|
restartIfChanged = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
systemd.services."container-getty@" =
|
2014-04-17 18:52:31 +02:00
|
|
|
|
{ unitConfig.ConditionPathExists = "/dev/pts/%I"; # Work around being respawned when "machinectl login" exits.
|
2014-04-16 16:10:11 +02:00
|
|
|
|
serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login --keep-baud pts/%I 115200,38400,9600 $TERM";
|
2014-03-12 18:29:06 +01:00
|
|
|
|
restartIfChanged = false;
|
|
|
|
|
};
|
2012-07-20 17:36:09 +02:00
|
|
|
|
|
2009-07-16 15:55:11 +02:00
|
|
|
|
environment.etc = singleton
|
|
|
|
|
{ # Friendly greeting on the virtual consoles.
|
2012-08-06 21:53:04 +02:00
|
|
|
|
source = pkgs.writeText "issue" ''
|
|
|
|
|
|
|
|
|
|
[1;32m${config.services.mingetty.greetingLine}[0m
|
|
|
|
|
${config.services.mingetty.helpLine}
|
|
|
|
|
|
|
|
|
|
'';
|
2009-05-28 13:34:46 +02:00
|
|
|
|
target = "issue";
|
2009-07-16 15:55:11 +02:00
|
|
|
|
};
|
2012-06-18 23:58:31 +02:00
|
|
|
|
|
2009-07-16 15:55:11 +02:00
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
2006-11-19 21:07:45 +01:00
|
|
|
|
}
|