Merge pull request #17082 from abbradar/fix-early-kbd

Use new early kbd-setting code in initrd and fix layouts from external packages

authored by Nikolay Amiantov and committed by GitHub 3cc54bba afcf3176

+17 -28
-4
nixos/modules/system/boot/stage-1-init.sh
··· 172 172 udevadm settle 173 173 174 174 175 - # Load boot-time keymap before any LVM/LUKS initialization 176 - @extraUtils@/bin/busybox loadkmap < "@busyboxKeymap@" 177 - 178 - 179 175 # XXX: Use case usb->lvm will still fail, usb->luks->lvm is covered 180 176 @preLVMCommands@ 181 177
+1 -10
nixos/modules/system/boot/stage-1.nix
··· 185 185 }; 186 186 187 187 188 - # The binary keymap for busybox to load at boot. 189 - busyboxKeymap = pkgs.runCommand "boottime-keymap" 190 - { preferLocalBuild = true; } 191 - '' 192 - ${pkgs.kbd}/bin/loadkeys -qb "${config.i18n.consoleKeyMap}" > $out || 193 - ${pkgs.kbd}/bin/loadkeys -qbu "${config.i18n.consoleKeyMap}" > $out 194 - ''; 195 - 196 - 197 188 # The init script of boot stage 1 (loading kernel modules for 198 189 # mounting the root FS). 199 190 bootStage1 = pkgs.substituteAll { ··· 203 194 204 195 isExecutable = true; 205 196 206 - inherit udevRules extraUtils modulesClosure busyboxKeymap; 197 + inherit udevRules extraUtils modulesClosure; 207 198 208 199 inherit (config.boot) resumeDevice devSize runSize; 209 200
+16 -14
nixos/modules/tasks/kbd.nix
··· 14 14 15 15 optimizedKeymap = pkgs.runCommand "keymap" { 16 16 nativeBuildInputs = [ pkgs.kbd ]; 17 + LOADKEYS_KEYMAP_PATH = "${kbdEnv}/share/keymaps/**"; 17 18 } '' 18 - cd ${kbdEnv}/share/keymaps 19 19 loadkeys -b ${optionalString isUnicode "-u"} "${config.i18n.consoleKeyMap}" > $out 20 20 ''; 21 21 ··· 61 61 default = false; 62 62 type = types.bool; 63 63 description = '' 64 - Enable setting font and keymap as early as possible (in initrd). 64 + Enable setting font as early as possible (in initrd). 65 65 ''; 66 66 }; 67 67 ··· 83 83 environment.etc."vconsole.conf".source = vconsoleConf; 84 84 # Provide kbd with additional packages. 85 85 environment.etc."kbd".source = "${kbdEnv}/share"; 86 + 87 + boot.initrd.preLVMCommands = mkBefore '' 88 + kbd_mode ${if isUnicode then "-u" else "-a"} -C /dev/console 89 + printf "\033%%${if isUnicode then "G" else "@"}" >> /dev/console 90 + loadkmap < ${optimizedKeymap} 91 + 92 + ${optionalString config.boot.earlyVconsoleSetup '' 93 + setfont -C /dev/console $extraUtils/share/consolefonts/font.psf 94 + ''} 95 + 96 + ${concatImapStringsSep "\n" (n: color: '' 97 + printf "${makeColorCS n color}" >> /dev/console 98 + '') config.i18n.consoleColors} 99 + ''; 86 100 } 87 101 88 102 (mkIf (!config.boot.earlyVconsoleSetup) { ··· 111 125 else 112 126 cp -L $font $out/share/consolefonts/font.psf 113 127 fi 114 - ''; 115 - 116 - boot.initrd.preLVMCommands = mkBefore '' 117 - kbd_mode ${if isUnicode then "-u" else "-a"} -C /dev/console 118 - printf "\033%%${if isUnicode then "G" else "@"}" >> /dev/console 119 - loadkmap < ${optimizedKeymap} 120 - 121 - setfont -C /dev/console $extraUtils/share/consolefonts/font.psf 122 - 123 - ${concatImapStringsSep "\n" (n: color: '' 124 - printf "${makeColorCS n color}" >> /dev/console 125 - '') config.i18n.consoleColors} 126 128 ''; 127 129 }) 128 130 ]))