2009-10-12 17:27:57 +00:00
|
|
|
|
{ config, pkgs, ... }:
|
2009-03-06 12:27:15 +00:00
|
|
|
|
|
2009-10-12 17:27:57 +00:00
|
|
|
|
with pkgs.lib;
|
2009-07-16 13:55:11 +00:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
###### interface
|
2009-03-06 12:27:15 +00:00
|
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2009-07-16 13:55:11 +00:00
|
|
|
|
services.mingetty = {
|
|
|
|
|
|
|
|
|
|
ttys = mkOption {
|
2011-01-29 23:06:57 +00: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 13:55:11 +00:00
|
|
|
|
description = ''
|
2009-09-23 20:50:53 +00:00
|
|
|
|
The list of tty devices on which to start a login prompt.
|
2009-07-16 13:55:11 +00: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-04-22 23:35:34 +00:00
|
|
|
|
default = ''<<< Welcome to NixOS ${config.system.nixosVersion} (\m) - \s \r (\l) >>>'';
|
2009-07-16 13:55:11 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Welcome line printed by mingetty.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-03-06 12:27:15 +00:00
|
|
|
|
|
2009-07-16 13:55:11 +00:00
|
|
|
|
helpLine = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
|
|
|
|
Help line printed by mingetty below the welcome line.
|
|
|
|
|
Used by the installation CD to give some hints on
|
|
|
|
|
how to proceed.
|
|
|
|
|
'';
|
2009-03-06 12:27:15 +00:00
|
|
|
|
};
|
2009-07-16 13:55:11 +00:00
|
|
|
|
|
2009-03-06 12:27:15 +00:00
|
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2009-03-06 12:27:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2009-07-16 13:55:11 +00:00
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
2011-09-14 18:20:50 +00:00
|
|
|
|
# Generate a separate job for each tty.
|
2009-10-12 18:09:34 +00:00
|
|
|
|
jobs = listToAttrs (map (tty: nameValuePair tty {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2012-03-12 14:33:06 +00:00
|
|
|
|
startOn =
|
2012-03-12 14:42:52 +00:00
|
|
|
|
# On tty1 we should always wait for mountall, since it may
|
|
|
|
|
# start an emergency-shell job.
|
|
|
|
|
if config.services.mingetty.waitOnMounts || tty == "tty1"
|
2012-03-12 14:33:06 +00:00
|
|
|
|
then "stopped udevtrigger and filesystem"
|
|
|
|
|
else "stopped udevtrigger"; # !!! should start as soon as the tty device is created
|
2009-07-16 13:55:11 +00:00
|
|
|
|
|
2011-11-25 16:32:54 +00:00
|
|
|
|
path = [ pkgs.mingetty ];
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2011-11-25 16:32:54 +00:00
|
|
|
|
exec = "mingetty --loginprog=${pkgs.shadow}/bin/login --noclear ${tty}";
|
|
|
|
|
|
|
|
|
|
environment.LOCALE_ARCHIVE = "/var/run/current-system/sw/lib/locale/locale-archive";
|
2011-10-18 21:44:35 +00:00
|
|
|
|
|
2009-10-12 17:27:57 +00:00
|
|
|
|
}) config.services.mingetty.ttys);
|
2009-07-16 13:55:11 +00:00
|
|
|
|
|
|
|
|
|
environment.etc = singleton
|
|
|
|
|
{ # Friendly greeting on the virtual consoles.
|
2009-05-28 11:34:46 +00:00
|
|
|
|
source = pkgs.writeText "issue" ''
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2009-05-28 11:34:46 +00:00
|
|
|
|
[1;32m${config.services.mingetty.greetingLine}[0m
|
|
|
|
|
${config.services.mingetty.helpLine}
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2009-05-28 11:34:46 +00:00
|
|
|
|
'';
|
|
|
|
|
target = "issue";
|
2009-07-16 13:55:11 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2006-11-19 20:07:45 +00:00
|
|
|
|
}
|