* Set the console font, the keymap, and Unicode/ASCII mode.
svn path=/nixos/trunk/; revision=8542
This commit is contained in:
parent
464d252d55
commit
174f4f2c99
|
@ -868,4 +868,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name = ["i18n" "consoleFont"];
|
||||||
|
default = "lat9w-16";
|
||||||
|
example = "LatArCyrHeb-16";
|
||||||
|
description = "
|
||||||
|
The font used for the virtual consoles. Leave empty to use
|
||||||
|
whatever the <command>setfont</command> program considers the
|
||||||
|
default font.
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name = ["i18n" "consoleKeyMap"];
|
||||||
|
default = "us";
|
||||||
|
example = "fr";
|
||||||
|
description = "
|
||||||
|
The keyboard mapping table for the virtual consoles.
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,6 +9,10 @@ let
|
||||||
optional = option: service:
|
optional = option: service:
|
||||||
if config.get option then [(makeJob service)] else [];
|
if config.get option then [(makeJob service)] else [];
|
||||||
|
|
||||||
|
requiredTTYs =
|
||||||
|
(config.get ["services" "mingetty" "ttys"])
|
||||||
|
++ [10] /* !!! sync with syslog.conf */ ;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
import ../upstart-jobs/gather.nix {
|
import ../upstart-jobs/gather.nix {
|
||||||
|
@ -86,6 +90,15 @@ import ../upstart-jobs/gather.nix {
|
||||||
inherit nssModulesPath;
|
inherit nssModulesPath;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Console font and keyboard maps.
|
||||||
|
(import ../upstart-jobs/kbd.nix {
|
||||||
|
inherit (pkgs) glibc kbd gzip;
|
||||||
|
ttyNumbers = requiredTTYs;
|
||||||
|
defaultLocale = config.get ["i18n" "defaultLocale"];
|
||||||
|
consoleFont = config.get ["i18n" "consoleFont"];
|
||||||
|
consoleKeyMap = config.get ["i18n" "consoleKeyMap"];
|
||||||
|
})
|
||||||
|
|
||||||
# Handles the maintenance/stalled event (single-user shell).
|
# Handles the maintenance/stalled event (single-user shell).
|
||||||
(import ../upstart-jobs/maintenance-shell.nix {
|
(import ../upstart-jobs/maintenance-shell.nix {
|
||||||
inherit (pkgs) bash;
|
inherit (pkgs) bash;
|
||||||
|
@ -193,10 +206,6 @@ import ../upstart-jobs/gather.nix {
|
||||||
|
|
||||||
overridenTTYs = map (x: x.tty) specificThemes;
|
overridenTTYs = map (x: x.tty) specificThemes;
|
||||||
|
|
||||||
requiredTTYs =
|
|
||||||
(config.get ["services" "mingetty" "ttys"])
|
|
||||||
++ [10] /* !!! sync with syslog.conf */ ;
|
|
||||||
|
|
||||||
# Use the default theme for all the mingetty ttys and for the
|
# Use the default theme for all the mingetty ttys and for the
|
||||||
# syslog tty, except those for which a specific theme is
|
# syslog tty, except those for which a specific theme is
|
||||||
# specified.
|
# specified.
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
{glibc, kbd, gzip, ttyNumbers, defaultLocale, consoleFont, consoleKeyMap}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
ttys = map (nr: "/dev/tty" + toString nr) ttyNumbers;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "kbd";
|
||||||
|
|
||||||
|
extraPath = [
|
||||||
|
kbd
|
||||||
|
];
|
||||||
|
|
||||||
|
job = "
|
||||||
|
description \"Keyboard / console initialisation\"
|
||||||
|
|
||||||
|
start on udev
|
||||||
|
|
||||||
|
script
|
||||||
|
|
||||||
|
export LANG=${defaultLocale}
|
||||||
|
export PATH=${gzip}/bin:$PATH # Needed by setfont
|
||||||
|
|
||||||
|
set +e # continue in case of errors
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable UTF-8 mode. This is based on
|
||||||
|
# unicode_{start,stop}.
|
||||||
|
echo 'Enabling or disabling Unicode mode...'
|
||||||
|
|
||||||
|
charMap=$(${glibc}/bin/locale charmap)
|
||||||
|
|
||||||
|
if test \"$charMap\" = UTF-8; then
|
||||||
|
|
||||||
|
for tty in ${toString ttys}; do
|
||||||
|
|
||||||
|
# Tell the console output driver that the bytes arriving are
|
||||||
|
# UTF-8 encoded multibyte sequences.
|
||||||
|
echo -n -e '\\033%G' > $tty
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# Set the keyboard driver in UTF-8 mode.
|
||||||
|
${kbd}/bin/kbd_mode -u
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
for tty in ${toString ttys}; do
|
||||||
|
|
||||||
|
# Tell the console output driver that the bytes arriving are
|
||||||
|
# UTF-8 encoded multibyte sequences.
|
||||||
|
echo -n -e '\\033%@' > $tty
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# Set the keyboard driver in ASCII (or any 8-bit character
|
||||||
|
# set) mode.
|
||||||
|
${kbd}/bin/kbd_mode -a
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Set the console font.
|
||||||
|
for tty in ${toString ttys}; do
|
||||||
|
${kbd}/bin/setfont -C $tty ${consoleFont}
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Set the keymap.
|
||||||
|
${kbd}/bin/loadkeys '${consoleKeyMap}'
|
||||||
|
|
||||||
|
|
||||||
|
end script
|
||||||
|
";
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue