diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 3622b21626b3..f58e540a6e5c 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -52,6 +52,15 @@ in ''; }; + consoleUseXkbConfig = mkOption { + type = types.bool; + default = false; + description = '' + If set, configure the console keymap from the xserver keyboard + settings. + ''; + }; + consoleKeyMap = mkOption { type = mkOptionType { name = "string or path"; @@ -74,6 +83,13 @@ in config = { + i18n.consoleKeyMap = with config.services.xserver; + mkIf config.i18n.consoleUseXkbConfig + (pkgs.runCommand "xkb-console-keymap" { preferLocalBuild = true; } '' + '${pkgs.ckbcomp}/bin/ckbcomp' -model '${xkbModel}' -layout '${layout}' \ + -option '${xkbOptions}' -variant '${xkbVariant}' > "$out" + ''); + environment.systemPackages = optional (config.i18n.supportedLocales != []) glibcLocales;