2009-10-12 18:27:57 +01:00
|
|
|
{ config, pkgs, ... }:
|
2007-04-04 18:10:38 +01:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
with pkgs.lib;
|
|
|
|
|
2007-04-04 18:10:38 +01:00
|
|
|
let
|
2009-05-28 17:03:48 +01:00
|
|
|
|
2009-07-15 12:19:11 +01:00
|
|
|
# think about where to put this chunk of code!
|
|
|
|
# required by other pieces as well
|
|
|
|
requiredTTYs = config.services.mingetty.ttys
|
|
|
|
++ config.boot.extraTTYs
|
2009-09-25 20:55:08 +01:00
|
|
|
++ [ config.services.syslogd.tty ];
|
|
|
|
ttys = map (dev: "/dev/${dev}") requiredTTYs;
|
2009-07-15 12:19:11 +01:00
|
|
|
consoleFont = config.i18n.consoleFont;
|
|
|
|
consoleKeyMap = config.i18n.consoleKeyMap;
|
2009-05-28 17:03:48 +01:00
|
|
|
|
2012-10-18 16:54:07 +01:00
|
|
|
vconsoleConf = pkgs.writeText "vconsole.conf"
|
|
|
|
''
|
|
|
|
KEYMAP=${consoleKeyMap}
|
|
|
|
FONT=${consoleFont}
|
|
|
|
'';
|
|
|
|
|
2009-07-15 12:19:11 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
2009-05-28 17:03:48 +01:00
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2009-07-15 12:19:11 +01:00
|
|
|
# most options are defined in i18n.nix
|
|
|
|
|
2012-07-24 18:53:17 +01:00
|
|
|
# FIXME: still needed?
|
2009-09-25 20:55:08 +01:00
|
|
|
boot.extraTTYs = mkOption {
|
2009-05-28 17:03:48 +01:00
|
|
|
default = [];
|
2009-09-25 20:55:08 +01:00
|
|
|
example = ["tty8" "tty9"];
|
|
|
|
description = ''
|
2009-05-28 17:03:48 +01:00
|
|
|
Tty (virtual console) devices, in addition to the consoles on
|
|
|
|
which mingetty and syslogd run, that must be initialised.
|
|
|
|
Only useful if you have some program that you want to run on
|
|
|
|
some fixed console. For example, the NixOS installation CD
|
|
|
|
opens the manual in a web browser on console 7, so it sets
|
2009-09-25 20:55:08 +01:00
|
|
|
<option>boot.extraTTYs</option> to <literal>["tty7"]</literal>.
|
|
|
|
'';
|
2009-05-28 17:03:48 +01:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-05-28 17:03:48 +01:00
|
|
|
# dummy option so that requiredTTYs can be passed
|
2009-09-25 20:55:08 +01:00
|
|
|
requiredTTYs = mkOption {
|
2009-05-28 17:03:48 +01:00
|
|
|
default = [];
|
|
|
|
description = "
|
|
|
|
FIXME: find another place for this option.
|
|
|
|
FIXME: find a good description.
|
|
|
|
";
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-07-15 12:19:11 +01:00
|
|
|
};
|
2007-04-04 18:10:38 +01:00
|
|
|
|
|
|
|
|
2009-07-15 12:19:11 +01:00
|
|
|
###### implementation
|
2007-04-04 18:10:38 +01:00
|
|
|
|
2011-09-14 19:20:50 +01:00
|
|
|
config = {
|
|
|
|
|
2009-07-15 12:19:11 +01:00
|
|
|
inherit requiredTTYs; # pass it to ./modules/tasks/tty-backgrounds.nix
|
2007-04-04 18:10:38 +01:00
|
|
|
|
2012-06-16 05:19:43 +01:00
|
|
|
environment.systemPackages = [ pkgs.kbd ];
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2012-07-24 18:53:17 +01:00
|
|
|
# Let systemd-vconsole-setup.service do the work of setting up the
|
|
|
|
# virtual consoles. FIXME: trigger a restart of
|
|
|
|
# systemd-vconsole-setup.service if /etc/vconsole.conf changes.
|
2013-02-03 12:24:22 +00:00
|
|
|
environment.etc."vconsole.conf".source = vconsoleConf;
|
2012-10-18 16:54:07 +01:00
|
|
|
|
|
|
|
# This is identical to the systemd-vconsole-setup.service unit
|
|
|
|
# shipped with systemd, except that it uses /dev/tty1 instead of
|
|
|
|
# /dev/tty0 to prevent putting the X server in non-raw mode, and
|
|
|
|
# it has a restart trigger.
|
2013-01-16 11:33:18 +00:00
|
|
|
systemd.services."systemd-vconsole-setup" =
|
2012-10-18 16:54:07 +01:00
|
|
|
{ description = "Setup Virtual Console";
|
2013-07-09 16:23:27 +01:00
|
|
|
wantedBy = [ "sysinit.target" "multi-user.target" ];
|
2012-10-18 16:54:07 +01:00
|
|
|
before = [ "sysinit.target" "shutdown.target" ];
|
|
|
|
unitConfig =
|
|
|
|
{ DefaultDependencies = "no";
|
|
|
|
Conflicts = "shutdown.target";
|
|
|
|
ConditionPathExists = "/dev/tty1";
|
|
|
|
};
|
|
|
|
serviceConfig =
|
|
|
|
{ Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
2013-01-16 12:17:57 +00:00
|
|
|
ExecStart = "${config.systemd.package}/lib/systemd/systemd-vconsole-setup /dev/tty1";
|
2012-10-18 16:54:07 +01:00
|
|
|
};
|
|
|
|
restartTriggers = [ vconsoleConf ];
|
2009-09-25 20:55:08 +01:00
|
|
|
};
|
2009-07-15 12:19:11 +01:00
|
|
|
|
2009-03-06 12:25:38 +00:00
|
|
|
};
|
2007-04-04 18:10:38 +01:00
|
|
|
|
|
|
|
}
|