at 15.09-beta 1.6 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 vconsoleConf = pkgs.writeText "vconsole.conf" 8 '' 9 KEYMAP=${config.i18n.consoleKeyMap} 10 FONT=${config.i18n.consoleFont} 11 ''; 12 13in 14 15{ 16 ###### interface 17 18 options = { 19 20 # most options are defined in i18n.nix 21 22 # FIXME: still needed? 23 boot.extraTTYs = mkOption { 24 default = []; 25 type = types.listOf types.str; 26 example = ["tty8" "tty9"]; 27 description = '' 28 Tty (virtual console) devices, in addition to the consoles on 29 which mingetty and syslogd run, that must be initialised. 30 Only useful if you have some program that you want to run on 31 some fixed console. For example, the NixOS installation CD 32 opens the manual in a web browser on console 7, so it sets 33 <option>boot.extraTTYs</option> to <literal>["tty7"]</literal>. 34 ''; 35 }; 36 37 }; 38 39 40 ###### implementation 41 42 config = { 43 44 environment.systemPackages = [ pkgs.kbd ]; 45 46 # Let systemd-vconsole-setup.service do the work of setting up the 47 # virtual consoles. FIXME: trigger a restart of 48 # systemd-vconsole-setup.service if /etc/vconsole.conf changes. 49 environment.etc."vconsole.conf".source = vconsoleConf; 50 51 # This is identical to the systemd-vconsole-setup.service unit 52 # shipped with systemd, except that it uses /dev/tty1 instead of 53 # /dev/tty0 to prevent putting the X server in non-raw mode, and 54 # it has a restart trigger. 55 systemd.services."systemd-vconsole-setup" = 56 { wantedBy = [ "multi-user.target" ]; 57 restartTriggers = [ vconsoleConf ]; 58 }; 59 60 }; 61 62}