nixos i18n: add option to set console keymap from xkb

Close #9675. The expression was refactored heavily by vcunat.
This commit is contained in:
Geoffrey Reedy 2015-09-06 00:43:57 -06:00 committed by Vladimír Čunát
parent 87012187b2
commit 9d3da3a3bf
1 changed files with 16 additions and 0 deletions

View File

@ -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;