stage-1: Add option to load keymap during bootup.

As non-QWERTY keyboards don't feel so warm and cozy if they hug QWERTY LUKS
password prompts, it was on honor for me to serve King Dvorak XV to fight the
glorious keyboard war against... what?! Yes, I'm awake!

We're fighting with loadkeys to spit out busybox binary keymaps against loadkmap
(loadkeys does have a special target -b for that).

And yep, I'm somewhat abusing preLVMCommands, if someone got issues with that,
feel free to introduce a new substitute in stage-i-init.sh.

Sent from my iPhone
This commit is contained in:
aszlig 2012-08-12 09:12:54 +02:00
parent 15a1efe023
commit eb0b2651b8

View File

@ -27,6 +27,15 @@ let
";
};
boot.initrd.loadConsoleKeyMap = mkOption {
default = false;
type = with types; bool;
description = ''
Load i18n.consoleKeyMap at boot time. This is especially useful if you
bring together a non-QWERTY keyboard with a LUKS password prompt.
'';
};
boot.initrd.checkJournalingFS = mkOption {
default = true;
type = types.bool;
@ -267,6 +276,14 @@ let
'';
# the binary keymap for busybox to load at boot
busyboxKeymap = pkgs.runCommand "boottime-keymap"
{ preferLocalBuild = true; }
''
${pkgs.kbd}/bin/loadkeys -qb "${config.i18n.consoleKeyMap}" > $out
'';
# The init script of boot stage 1 (loading kernel modules for
# mounting the root FS).
bootStage1 = pkgs.substituteAll {
@ -281,7 +298,12 @@ let
inherit (config.boot) resumeDevice devSize runSize;
inherit (config.boot.initrd) checkJournalingFS
preLVMCommands postDeviceCommands postMountCommands kernelModules;
postDeviceCommands postMountCommands kernelModules;
preLVMCommands = (optionalString config.boot.initrd.loadConsoleKeyMap ''
# load boot-time keymap before any LVM/LUKS initialization
${extraUtils}/bin/busybox loadkmap < "${busyboxKeymap}"
'') + config.boot.initrd.preLVMCommands;
fsInfo =
let f = fs: [ fs.mountPoint (if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}") fs.fsType fs.options ];