2009-10-12 18:27:57 +01:00
|
|
|
|
{ config, pkgs, ... }:
|
2009-03-06 12:27:15 +00:00
|
|
|
|
|
2009-10-12 18:27:57 +01:00
|
|
|
|
with pkgs.lib;
|
2009-07-16 14:55:11 +01:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
###### interface
|
2009-03-06 12:27:15 +00:00
|
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2009-07-16 14:55:11 +01:00
|
|
|
|
services.mingetty = {
|
|
|
|
|
|
|
|
|
|
greetingLine = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.str;
|
2012-06-07 00:14:57 +01:00
|
|
|
|
default = ''<<< Welcome to NixOS ${config.system.nixosVersion} (\m) - \l >>>'';
|
2009-07-16 14:55:11 +01:00
|
|
|
|
description = ''
|
|
|
|
|
Welcome line printed by mingetty.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-03-06 12:27:15 +00:00
|
|
|
|
|
2009-07-16 14:55:11 +01:00
|
|
|
|
helpLine = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2009-07-16 14:55:11 +01:00
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
2012-06-18 22:58:31 +01:00
|
|
|
|
Help line printed by mingetty below the welcome line.
|
2009-07-16 14:55:11 +01:00
|
|
|
|
Used by the installation CD to give some hints on
|
|
|
|
|
how to proceed.
|
|
|
|
|
'';
|
2009-03-06 12:27:15 +00:00
|
|
|
|
};
|
2009-07-16 14:55:11 +01:00
|
|
|
|
|
2009-03-06 12:27:15 +00:00
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2009-03-06 12:27:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2009-07-16 14:55:11 +01:00
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
2012-07-20 16:36:09 +01:00
|
|
|
|
# FIXME: these are mostly copy/pasted from the systemd sources,
|
|
|
|
|
# which some small modifications, which is annoying.
|
|
|
|
|
|
2011-09-14 19:20:50 +01:00
|
|
|
|
# Generate a separate job for each tty.
|
2013-01-16 11:33:18 +00:00
|
|
|
|
systemd.units."getty@.service".text =
|
2012-06-18 22:55:27 +01:00
|
|
|
|
''
|
|
|
|
|
[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
|
|
|
|
|
|
2012-07-20 16:36:09 +01:00
|
|
|
|
ConditionPathExists=/dev/tty0
|
|
|
|
|
|
2012-06-18 22:55:27 +01:00
|
|
|
|
[Service]
|
|
|
|
|
Environment=TERM=linux
|
2012-07-16 22:27:11 +01:00
|
|
|
|
Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
|
2012-08-06 20:53:04 +01:00
|
|
|
|
ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login %I 38400
|
2012-06-18 22:55:27 +01:00
|
|
|
|
Type=idle
|
|
|
|
|
Restart=always
|
|
|
|
|
RestartSec=0
|
|
|
|
|
UtmpIdentifier=%I
|
|
|
|
|
TTYPath=/dev/%I
|
|
|
|
|
TTYReset=yes
|
|
|
|
|
TTYVHangup=yes
|
2012-07-20 22:39:05 +01:00
|
|
|
|
TTYVTDisallocate=yes # set to no to prevent clearing the screen
|
2012-06-18 22:55:27 +01:00
|
|
|
|
KillMode=process
|
|
|
|
|
IgnoreSIGPIPE=no
|
|
|
|
|
|
|
|
|
|
# Some login implementations ignore SIGTERM, so we send SIGHUP
|
|
|
|
|
# instead, to ensure that login terminates cleanly.
|
|
|
|
|
KillSignal=SIGHUP
|
2012-08-23 16:13:33 +01:00
|
|
|
|
|
|
|
|
|
X-RestartIfChanged=false
|
2012-06-18 22:55:27 +01:00
|
|
|
|
'';
|
2012-08-06 20:53:04 +01:00
|
|
|
|
|
2013-01-16 11:33:18 +00:00
|
|
|
|
systemd.units."serial-getty@.service".text =
|
2012-07-20 16:36:09 +01:00
|
|
|
|
''
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=Serial Getty on %I
|
|
|
|
|
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
|
|
|
|
BindsTo=dev-%i.device
|
|
|
|
|
After=dev-%i.device 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=/run/current-system/sw/lib/locale/locale-archive
|
2013-06-14 16:51:59 +01:00
|
|
|
|
ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I 115200,57600,38400,9600
|
2012-07-20 16:36:09 +01:00
|
|
|
|
Type=idle
|
|
|
|
|
Restart=always
|
|
|
|
|
RestartSec=0
|
|
|
|
|
UtmpIdentifier=%I
|
|
|
|
|
TTYPath=/dev/%I
|
|
|
|
|
TTYReset=yes
|
|
|
|
|
TTYVHangup=yes
|
|
|
|
|
KillMode=process
|
|
|
|
|
IgnoreSIGPIPE=no
|
|
|
|
|
|
|
|
|
|
# Some login implementations ignore SIGTERM, so we send SIGHUP
|
|
|
|
|
# instead, to ensure that login terminates cleanly.
|
|
|
|
|
KillSignal=SIGHUP
|
2012-08-23 16:13:33 +01:00
|
|
|
|
|
|
|
|
|
X-RestartIfChanged=false
|
2012-07-20 16:36:09 +01:00
|
|
|
|
'';
|
|
|
|
|
|
2009-07-16 14:55:11 +01:00
|
|
|
|
environment.etc = singleton
|
|
|
|
|
{ # Friendly greeting on the virtual consoles.
|
2012-08-06 20:53:04 +01:00
|
|
|
|
source = pkgs.writeText "issue" ''
|
|
|
|
|
|
|
|
|
|
[1;32m${config.services.mingetty.greetingLine}[0m
|
|
|
|
|
${config.services.mingetty.helpLine}
|
|
|
|
|
|
|
|
|
|
'';
|
2009-05-28 12:34:46 +01:00
|
|
|
|
target = "issue";
|
2009-07-16 14:55:11 +01:00
|
|
|
|
};
|
2012-06-18 22:58:31 +01:00
|
|
|
|
|
2009-07-16 14:55:11 +01:00
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2006-11-19 20:07:45 +00:00
|
|
|
|
}
|