summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichele Guerini Rocco <rnhmjoj@users.noreply.github.com>2021-07-23 08:14:53 +0200
committerGitHub <noreply@github.com>2021-07-23 08:14:53 +0200
commit75c433e911c4c7d809ec8173719c8beaa00dc394 (patch)
tree46f31fd17fc1cba4335aa61a42ceec997e1936f7
parentefbc139f5df984bf083820cf31ee352a0788d70f (diff)
parent6f89feaeddacab8ad30909dae968bba5b9a066e7 (diff)
downloadnixpkgs-75c433e911c4c7d809ec8173719c8beaa00dc394.tar
nixpkgs-75c433e911c4c7d809ec8173719c8beaa00dc394.tar.gz
nixpkgs-75c433e911c4c7d809ec8173719c8beaa00dc394.tar.bz2
nixpkgs-75c433e911c4c7d809ec8173719c8beaa00dc394.tar.lz
nixpkgs-75c433e911c4c7d809ec8173719c8beaa00dc394.tar.xz
nixpkgs-75c433e911c4c7d809ec8173719c8beaa00dc394.tar.zst
nixpkgs-75c433e911c4c7d809ec8173719c8beaa00dc394.zip
Merge pull request #125704 from zanculmarktum/fix/kbd-search-paths
kbd: update search-paths.patch
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/kbd-update-search-paths-patch.nix18
-rw-r--r--pkgs/os-specific/linux/kbd/default.nix6
-rw-r--r--pkgs/os-specific/linux/kbd/search-paths.patch85
4 files changed, 109 insertions, 1 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 0e2104a20e2..071a8175b4d 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -204,6 +204,7 @@ in
   k3s = handleTest ./k3s.nix {};
   kafka = handleTest ./kafka.nix {};
   kbd-setfont-decompress = handleTest ./kbd-setfont-decompress.nix {};
+  kbd-update-search-paths-patch = handleTest ./kbd-update-search-paths-patch.nix {};
   kea = handleTest ./kea.nix {};
   keepalived = handleTest ./keepalived.nix {};
   keepassxc = handleTest ./keepassxc.nix {};
diff --git a/nixos/tests/kbd-update-search-paths-patch.nix b/nixos/tests/kbd-update-search-paths-patch.nix
new file mode 100644
index 00000000000..2967ee48903
--- /dev/null
+++ b/nixos/tests/kbd-update-search-paths-patch.nix
@@ -0,0 +1,18 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+  name = "kbd-update-search-paths-patch";
+
+  machine = { pkgs, options, ... }: {
+    console = {
+      packages = options.console.packages.default ++ [ pkgs.terminus_font ];
+    };
+  };
+
+  testScript = ''
+    command = "${pkgs.kbd}/bin/setfont ter-112n 2>&1"
+    (status, out) = machine.execute(command)
+    pattern = re.compile(r".*Unable to find file:.*")
+    match = pattern.match(out)
+    if match:
+        raise Exception("command `{}` failed".format(command))
+  '';
+})
diff --git a/pkgs/os-specific/linux/kbd/default.nix b/pkgs/os-specific/linux/kbd/default.nix
index c7a59e59cab..23a523b15d7 100644
--- a/pkgs/os-specific/linux/kbd/default.nix
+++ b/pkgs/os-specific/linux/kbd/default.nix
@@ -29,6 +29,10 @@ stdenv.mkDerivation rec {
     "--disable-nls"
   ];
 
+  patches = [
+    ./search-paths.patch
+  ];
+
   postPatch =
     ''
       # Renaming keymaps with name clashes, because loadkeys just picks
@@ -62,7 +66,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkg-config flex ];
 
   passthru.tests = {
-    inherit (nixosTests) keymap kbd-setfont-decompress;
+    inherit (nixosTests) keymap kbd-setfont-decompress kbd-update-search-paths-patch;
   };
 
   meta = with lib; {
diff --git a/pkgs/os-specific/linux/kbd/search-paths.patch b/pkgs/os-specific/linux/kbd/search-paths.patch
new file mode 100644
index 00000000000..3b337ca7cc2
--- /dev/null
+++ b/pkgs/os-specific/linux/kbd/search-paths.patch
@@ -0,0 +1,85 @@
+Add /etc/kbd to the list of directories to search for the console
+fonts, screen mappings, Unicode maps, keytable files, etc.
+
+Without this patch, kbd will only look inside
+/nix/store/<hash>-kbd-x.x.x/share.
+
+--- a/src/libkeymap/analyze.l
++++ b/src/libkeymap/analyze.l
+@@ -109,6 +109,9 @@ static const char *const include_dirpath1[] = {
+ 	NULL
+ };
+ static const char *const include_dirpath3[] = {
++	"/etc/kbd/" KEYMAPDIR "/include/",
++	"/etc/kbd/" KEYMAPDIR "/i386/include/",
++	"/etc/kbd/" KEYMAPDIR "/mac/include/",
+ 	DATADIR "/" KEYMAPDIR "/include/",
+ 	DATADIR "/" KEYMAPDIR "/i386/include/",
+ 	DATADIR "/" KEYMAPDIR "/mac/include/",
+--- a/src/libkfont/context.c
++++ b/src/libkfont/context.c
+@@ -13,6 +13,7 @@
+ /* search for the map file in these directories (with trailing /) */
+ static const char *const mapdirpath[]  = {
+ 	"",
++	"/etc/kbd/" TRANSDIR "/",
+ 	DATADIR "/" TRANSDIR "/",
+ 	NULL
+ };
+@@ -28,6 +29,7 @@ static const char *const mapsuffixes[] = {
+ /* search for the font in these directories (with trailing /) */
+ static const char *const fontdirpath[]  = {
+ 	"",
++	"/etc/kbd/" FONTDIR "/",
+ 	DATADIR "/" FONTDIR "/",
+ 	NULL
+ };
+@@ -42,6 +44,7 @@ static char const *const fontsuffixes[] = {
+ 
+ static const char *const unidirpath[]  = {
+ 	"",
++	"/etc/kbd/" UNIMAPDIR "/",
+ 	DATADIR "/" UNIMAPDIR "/",
+ 	NULL
+ };
+@@ -55,6 +58,7 @@ static const char *const unisuffixes[] = {
+ /* hide partial fonts a bit - loading a single one is a bad idea */
+ const char *const partfontdirpath[]  = {
+ 	"",
++	"/etc/kbd/" FONTDIR "/" PARTIALDIR "/",
+ 	DATADIR "/" FONTDIR "/" PARTIALDIR "/",
+ 	NULL
+ };
+--- a/src/loadkeys.c
++++ b/src/loadkeys.c
+@@ -27,6 +27,7 @@
+ 
+ static const char *const dirpath1[] = {
+ 	"",
++	"/etc/kbd/" KEYMAPDIR "/**",
+ 	DATADIR "/" KEYMAPDIR "/**",
+ 	KERNDIR "/",
+ 	NULL
+--- a/src/resizecons.c
++++ b/src/resizecons.c
+@@ -104,6 +104,7 @@ static void vga_set_verticaldisplayend_lowbyte(int);
+ 
+ const char *const dirpath[]  = {
+ 	"",
++	"/etc/kbd/" VIDEOMODEDIR "/",
+ 	DATADIR "/" VIDEOMODEDIR "/",
+ 	NULL
+ };
+--- a/src/setfont.c
++++ b/src/setfont.c
+@@ -48,8 +48,8 @@ usage(void)
+ 	                    "    -v         Be verbose.\n"
+ 	                    "    -C <cons>  Indicate console device to be used.\n"
+ 	                    "    -V         Print version and exit.\n"
+-	                    "Files are loaded from the current directory or %s/*/.\n"),
+-	        DATADIR);
++	                    "Files are loaded from the current directory or %s/*/ or %s/*/.\n"),
++	        DATADIR, "/etc/kbd");
+ 	exit(EX_USAGE);
+ }
+