2009-10-12 19:27:57 +02:00
|
|
|
|
{ config, pkgs, ... }:
|
2009-03-06 13:27:15 +01:00
|
|
|
|
|
2009-10-12 19:27:57 +02:00
|
|
|
|
with pkgs.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 = {
|
|
|
|
|
|
2012-06-18 23:55:27 +02:00
|
|
|
|
# FIXME
|
2009-07-16 15:55:11 +02:00
|
|
|
|
ttys = mkOption {
|
2011-01-30 00:06:57 +01:00
|
|
|
|
default =
|
|
|
|
|
if pkgs.stdenv.isArm
|
|
|
|
|
then [ "ttyS0" ] # presumably an embedded platform such as a plug
|
|
|
|
|
else [ "tty1" "tty2" "tty3" "tty4" "tty5" "tty6" ];
|
2009-07-16 15:55:11 +02:00
|
|
|
|
description = ''
|
2009-09-23 22:50:53 +02:00
|
|
|
|
The list of tty devices on which to start a login prompt.
|
2009-07-16 15:55:11 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
waitOnMounts = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether the login prompts on the virtual consoles will be
|
|
|
|
|
started before or after all file systems have been mounted. By
|
|
|
|
|
default we don't wait, but if for example your /home is on a
|
|
|
|
|
separate partition, you may want to turn this on.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
greetingLine = mkOption {
|
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 {
|
|
|
|
|
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
|
|
|
|
|
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 = {
|
|
|
|
|
|
2011-09-14 20:20:50 +02:00
|
|
|
|
# Generate a separate job for each tty.
|
2012-06-18 23:55:27 +02:00
|
|
|
|
boot.systemd.units."getty@.service".text =
|
|
|
|
|
''
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=Getty on %I
|
|
|
|
|
Documentation=man:agetty(8)
|
|
|
|
|
After=systemd-user-sessions.service plymouth-quit-wait.service
|
|
|
|
|
|
|
|
|
|
# If additional gettys are spawned during boot then we should make
|
|
|
|
|
# sure that this is synchronized before getty.target, even though
|
|
|
|
|
# getty.target didn't actually pull it in.
|
|
|
|
|
Before=getty.target
|
|
|
|
|
IgnoreOnIsolate=yes
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Environment=TERM=linux
|
|
|
|
|
Environment=LOCALE_ARCHIVE=/var/run/current-system/sw/lib/locale/locale-archive
|
|
|
|
|
ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login %I 38400
|
|
|
|
|
Type=idle
|
|
|
|
|
Restart=always
|
|
|
|
|
RestartSec=0
|
|
|
|
|
UtmpIdentifier=%I
|
|
|
|
|
TTYPath=/dev/%I
|
|
|
|
|
TTYReset=yes
|
|
|
|
|
TTYVHangup=yes
|
|
|
|
|
TTYVTDisallocate=yes
|
|
|
|
|
KillMode=process
|
|
|
|
|
IgnoreSIGPIPE=no
|
|
|
|
|
|
|
|
|
|
# Some login implementations ignore SIGTERM, so we send SIGHUP
|
|
|
|
|
# instead, to ensure that login terminates cleanly.
|
|
|
|
|
KillSignal=SIGHUP
|
|
|
|
|
'';
|
|
|
|
|
|
2009-07-16 15:55:11 +02:00
|
|
|
|
environment.etc = singleton
|
|
|
|
|
{ # Friendly greeting on the virtual consoles.
|
2009-05-28 13:34:46 +02:00
|
|
|
|
source = pkgs.writeText "issue" ''
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
2009-05-28 13:34:46 +02:00
|
|
|
|
[1;32m${config.services.mingetty.greetingLine}[0m
|
|
|
|
|
${config.services.mingetty.helpLine}
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
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
|
|
|
|
}
|