summary refs log tree commit diff
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-07-20 23:52:45 +0400
committerGitHub <noreply@github.com>2016-07-20 23:52:45 +0400
commit3cc54bbad943dd60fbf87b59178f66b321792a91 (patch)
treedd4d98f516085ca1e66d5add5d78118a93dfdf52
parentafcf3176ec9dcb3fe6d00c7161d592b52a04203c (diff)
parentcf64a7ecc0f0feb654255a427e454a233773bbb9 (diff)
downloadnixlib-3cc54bbad943dd60fbf87b59178f66b321792a91.tar
nixlib-3cc54bbad943dd60fbf87b59178f66b321792a91.tar.gz
nixlib-3cc54bbad943dd60fbf87b59178f66b321792a91.tar.bz2
nixlib-3cc54bbad943dd60fbf87b59178f66b321792a91.tar.lz
nixlib-3cc54bbad943dd60fbf87b59178f66b321792a91.tar.xz
nixlib-3cc54bbad943dd60fbf87b59178f66b321792a91.tar.zst
nixlib-3cc54bbad943dd60fbf87b59178f66b321792a91.zip
Merge pull request #17082 from abbradar/fix-early-kbd
Use new early kbd-setting code in initrd and fix layouts from external packages
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh4
-rw-r--r--nixos/modules/system/boot/stage-1.nix11
-rw-r--r--nixos/modules/tasks/kbd.nix30
3 files changed, 17 insertions, 28 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index 7705dcb2d125..82995d5bab11 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -172,10 +172,6 @@ udevadm trigger --action=add
 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
 @preLVMCommands@
 
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index 4b1d3efb4113..21a49d45789e 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -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
   # mounting the root FS).
   bootStage1 = pkgs.substituteAll {
@@ -203,7 +194,7 @@ let
 
     isExecutable = true;
 
-    inherit udevRules extraUtils modulesClosure busyboxKeymap;
+    inherit udevRules extraUtils modulesClosure;
 
     inherit (config.boot) resumeDevice devSize runSize;
 
diff --git a/nixos/modules/tasks/kbd.nix b/nixos/modules/tasks/kbd.nix
index 8cdd34ef174c..789a04c7af8a 100644
--- a/nixos/modules/tasks/kbd.nix
+++ b/nixos/modules/tasks/kbd.nix
@@ -14,8 +14,8 @@ let
 
   optimizedKeymap = pkgs.runCommand "keymap" {
     nativeBuildInputs = [ pkgs.kbd ];
+    LOADKEYS_KEYMAP_PATH = "${kbdEnv}/share/keymaps/**";
   } ''
-    cd ${kbdEnv}/share/keymaps
     loadkeys -b ${optionalString isUnicode "-u"} "${config.i18n.consoleKeyMap}" > $out
   '';
 
@@ -61,7 +61,7 @@ in
       default = false;
       type = types.bool;
       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;
         # Provide kbd with additional packages.
         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) {
@@ -112,18 +126,6 @@ in
             cp -L $font $out/share/consolefonts/font.psf
           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}
-        '';
       })
     ]))
   ];