From 5878d67db747de863c7b8c06faeeeef49c08e0d3 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 2 Dec 2025 15:20:19 +0200 Subject: [PATCH 1/2] nixosTests.console-xkb-and-i18n: init Based upon reproducer posted here: https://github.com/NixOS/nixpkgs/issues/445666#issuecomment-3331002679 --- nixos/tests/all-tests.nix | 1 + nixos/tests/console-xkb-and-i18n.nix | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 nixos/tests/console-xkb-and-i18n.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 4edc8777cf16..0e3e7506ee6d 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -385,6 +385,7 @@ in collectd = runTest ./collectd.nix; commafeed = runTest ./commafeed.nix; connman = runTest ./connman.nix; + console-xkb-and-i18n = runTest ./console-xkb-and-i18n.nix; consul = runTest ./consul.nix; consul-template = runTest ./consul-template.nix; containers-bridge = runTest ./containers-bridge.nix; diff --git a/nixos/tests/console-xkb-and-i18n.nix b/nixos/tests/console-xkb-and-i18n.nix new file mode 100644 index 000000000000..6dfada160e56 --- /dev/null +++ b/nixos/tests/console-xkb-and-i18n.nix @@ -0,0 +1,23 @@ +{ lib, ... }: +{ + name = "console-xkb-and-i18n"; + meta.maintainers = with lib.maintainers; [ doronbehar ]; + + nodes = { + # Nothing to run on this node, a bug (TODO: where?) is causing a builder of + # the configuration to fail. See: + # + # - https://github.com/NixOS/nixpkgs/issues/445666 + # - https://github.com/NixOS/nixpkgs/issues/411374 + # + x = { + i18n.defaultLocale = "eo"; + console.useXkbConfig = true; + services.xserver.xkb = { + layout = "us"; + variant = "colemak"; + }; + }; + }; + testScript = { nodes, ... }: ""; +} From 30a3aafae16684e9fee2cf088026532442d73989 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 2 Dec 2025 15:45:34 +0200 Subject: [PATCH 2/2] nixos/console: fix optimizedKeymap derivation isUnicode condition The `optimizedKeymap` derivation was introduced in commit c9276c1b5256 (2019) to pre-compile text keymaps into binary format for faster loading during early boot (initrd). The `-u` flag of `loadkeys` command enables Unicode mode, allowing the keymap to contain Unicode keysyms (like `leftquote`, `left_double_quotation_mark`). Without `-u` only non-Unicode keysyms are supported (suitable for `ISO-8859-*` character sets). When `console.useXkbConfig = true`, the keymap is generated by `ckbcomp` which always produces Unicode keysyms, regardless of the local charset. Hence this commit is a followup to #408307, and fixes #445666 for sure while probably also fixing #411374 . --- nixos/modules/config/console.nix | 2 +- nixos/tests/console-xkb-and-i18n.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/modules/config/console.nix b/nixos/modules/config/console.nix index d0672c792bf8..571f723a823f 100644 --- a/nixos/modules/config/console.nix +++ b/nixos/modules/config/console.nix @@ -9,7 +9,7 @@ let makeColor = i: lib.concatMapStringsSep "," (x: "0x" + lib.substring (2 * i) 2 x); - isUnicode = lib.hasSuffix "UTF-8" (lib.toUpper config.i18n.defaultLocale); + isUnicode = config.i18n.defaultCharset == "UTF-8" || cfg.useXkbConfig; optimizedKeymap = pkgs.runCommand "keymap" diff --git a/nixos/tests/console-xkb-and-i18n.nix b/nixos/tests/console-xkb-and-i18n.nix index 6dfada160e56..757825a785af 100644 --- a/nixos/tests/console-xkb-and-i18n.nix +++ b/nixos/tests/console-xkb-and-i18n.nix @@ -4,8 +4,8 @@ meta.maintainers = with lib.maintainers; [ doronbehar ]; nodes = { - # Nothing to run on this node, a bug (TODO: where?) is causing a builder of - # the configuration to fail. See: + # Nothing to run on this node. Only verify that this configuration doesn't + # produce the bugs described here: # # - https://github.com/NixOS/nixpkgs/issues/445666 # - https://github.com/NixOS/nixpkgs/issues/411374