nixos stage-1: move keymap handling to kbd module
This commit is contained in:
parent
6f89369440
commit
7bed3d0cb3
nixos/modules
|
@ -172,10 +172,6 @@ udevadm trigger --action=add
|
||||||
udevadm settle
|
udevadm settle
|
||||||
|
|
||||||
|
|
||||||
# Load boot-time keymap before any LVM/LUKS initialization
|
|
||||||
@extraUtils@/bin/busybox loadkmap < "@busyboxKeymap@"
|
|
||||||
|
|
||||||
|
|
||||||
# XXX: Use case usb->lvm will still fail, usb->luks->lvm is covered
|
# XXX: Use case usb->lvm will still fail, usb->luks->lvm is covered
|
||||||
@preLVMCommands@
|
@preLVMCommands@
|
||||||
|
|
||||||
|
|
|
@ -185,15 +185,6 @@ 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 ||
|
|
||||||
${pkgs.kbd}/bin/loadkeys -qbu "${config.i18n.consoleKeyMap}" > $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
|
||||||
# The init script of boot stage 1 (loading kernel modules for
|
# The init script of boot stage 1 (loading kernel modules for
|
||||||
# mounting the root FS).
|
# mounting the root FS).
|
||||||
bootStage1 = pkgs.substituteAll {
|
bootStage1 = pkgs.substituteAll {
|
||||||
|
@ -203,7 +194,7 @@ let
|
||||||
|
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
|
|
||||||
inherit udevRules extraUtils modulesClosure busyboxKeymap;
|
inherit udevRules extraUtils modulesClosure;
|
||||||
|
|
||||||
inherit (config.boot) resumeDevice devSize runSize;
|
inherit (config.boot) resumeDevice devSize runSize;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ in
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = ''
|
description = ''
|
||||||
Enable setting font and keymap as early as possible (in initrd).
|
Enable setting font as early as possible (in initrd).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,6 +83,20 @@ in
|
||||||
environment.etc."vconsole.conf".source = vconsoleConf;
|
environment.etc."vconsole.conf".source = vconsoleConf;
|
||||||
# Provide kbd with additional packages.
|
# Provide kbd with additional packages.
|
||||||
environment.etc."kbd".source = "${kbdEnv}/share";
|
environment.etc."kbd".source = "${kbdEnv}/share";
|
||||||
|
|
||||||
|
boot.initrd.preLVMCommands = mkBefore ''
|
||||||
|
kbd_mode ${if isUnicode then "-u" else "-a"} -C /dev/console
|
||||||
|
printf "\033%%${if isUnicode then "G" else "@"}" >> /dev/console
|
||||||
|
loadkmap < ${optimizedKeymap}
|
||||||
|
|
||||||
|
${optionalString config.boot.earlyVconsoleSetup ''
|
||||||
|
setfont -C /dev/console $extraUtils/share/consolefonts/font.psf
|
||||||
|
''}
|
||||||
|
|
||||||
|
${concatImapStringsSep "\n" (n: color: ''
|
||||||
|
printf "${makeColorCS n color}" >> /dev/console
|
||||||
|
'') config.i18n.consoleColors}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf (!config.boot.earlyVconsoleSetup) {
|
(mkIf (!config.boot.earlyVconsoleSetup) {
|
||||||
|
@ -112,18 +126,6 @@ in
|
||||||
cp -L $font $out/share/consolefonts/font.psf
|
cp -L $font $out/share/consolefonts/font.psf
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
boot.initrd.preLVMCommands = mkBefore ''
|
|
||||||
kbd_mode ${if isUnicode then "-u" else "-a"} -C /dev/console
|
|
||||||
printf "\033%%${if isUnicode then "G" else "@"}" >> /dev/console
|
|
||||||
loadkmap < ${optimizedKeymap}
|
|
||||||
|
|
||||||
setfont -C /dev/console $extraUtils/share/consolefonts/font.psf
|
|
||||||
|
|
||||||
${concatImapStringsSep "\n" (n: color: ''
|
|
||||||
printf "${makeColorCS n color}" >> /dev/console
|
|
||||||
'') config.i18n.consoleColors}
|
|
||||||
'';
|
|
||||||
})
|
})
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue