From 9d3da3a3bfef8d356cedc0ea546d7fe0ca907c64 Mon Sep 17 00:00:00 2001 From: Geoffrey Reedy Date: Sun, 6 Sep 2015 00:43:57 -0600 Subject: [PATCH] nixos i18n: add option to set console keymap from xkb Close #9675. The expression was refactored heavily by vcunat. --- nixos/modules/config/i18n.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 3622b21626b..f58e540a6e5 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;