2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2007-04-04 19:10:38 +02:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2009-09-25 21:55:08 +02:00
|
|
|
|
2007-04-04 19:10:38 +02:00
|
|
|
let
|
2009-05-28 18:03:48 +02:00
|
|
|
|
2015-09-03 05:27:56 +02:00
|
|
|
makeColor = n: value: "COLOR_${toString n}=${value}";
|
2016-01-17 17:54:33 +01:00
|
|
|
colors = concatImapStringsSep "\n" makeColor config.i18n.consoleColors;
|
2015-09-03 05:27:56 +02:00
|
|
|
|
2016-01-17 17:54:33 +01:00
|
|
|
vconsoleConf = pkgs.writeText "vconsole.conf" ''
|
|
|
|
KEYMAP=${config.i18n.consoleKeyMap}
|
|
|
|
FONT=${config.i18n.consoleFont}
|
|
|
|
${colors}
|
|
|
|
'';
|
2016-02-09 01:00:53 +01:00
|
|
|
|
|
|
|
setVconsole = !config.boot.isContainer;
|
2009-07-15 13:19:11 +02:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
2009-05-28 18:03:48 +02:00
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2009-07-15 13:19:11 +02:00
|
|
|
# most options are defined in i18n.nix
|
|
|
|
|
2012-07-24 19:53:17 +02:00
|
|
|
# FIXME: still needed?
|
2009-09-25 21:55:08 +02:00
|
|
|
boot.extraTTYs = mkOption {
|
2009-05-28 18:03:48 +02:00
|
|
|
default = [];
|
2015-06-15 18:18:46 +02:00
|
|
|
type = types.listOf types.str;
|
2009-09-25 21:55:08 +02:00
|
|
|
example = ["tty8" "tty9"];
|
|
|
|
description = ''
|
2009-05-28 18:03:48 +02: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 21:55:08 +02:00
|
|
|
<option>boot.extraTTYs</option> to <literal>["tty7"]</literal>.
|
|
|
|
'';
|
2009-05-28 18:03:48 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-07-15 13:19:11 +02:00
|
|
|
};
|
2007-04-04 19:10:38 +02:00
|
|
|
|
|
|
|
|
2009-07-15 13:19:11 +02:00
|
|
|
###### implementation
|
2007-04-04 19:10:38 +02:00
|
|
|
|
2016-02-09 01:00:53 +01:00
|
|
|
config = mkMerge [
|
|
|
|
(mkIf (!setVconsole) {
|
|
|
|
systemd.services."systemd-vconsole-setup".enable = false;
|
|
|
|
})
|
|
|
|
|
|
|
|
(mkIf setVconsole {
|
|
|
|
environment.systemPackages = [ pkgs.kbd ];
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
environment.etc = [ {
|
|
|
|
target = "vconsole.conf";
|
|
|
|
source = vconsoleConf;
|
|
|
|
} ];
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
systemd.services."systemd-vconsole-setup" =
|
|
|
|
{ wantedBy = [ "multi-user.target" ];
|
|
|
|
before = [ "display-manager.service" ];
|
|
|
|
after = [ "systemd-udev-settle.service" ];
|
|
|
|
restartTriggers = [ vconsoleConf ];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2007-04-04 19:10:38 +02:00
|
|
|
|
|
|
|
}
|