nixpkgs-suyu/pkgs
aszlig 6e5d2f8963
nixos/xserver: Properly validate XKB options
Checking the keyboard layout has been a long set of hurdles so far, with
several attempts. Originally, the checking was introduced by @lheckemann
in #23709.

The initial implementation just was trying to check whether the symbols/
directory contained the layout name.

Unfortunately, that wasn't enough and keyboard variants weren't
recognized, so if you set layout to eg. "dvorak" it will fail with an
error (#25526).

So my improvement on that was to use sed to filter rules/base.lst and
match the layout against that. I fucked up twice with this, first
because layout can be a comma-separated list which I didn't account for
and second because I ran into a Nix issue (NixOS/nix#1426).

After fixing this, it still wasn't enough (and this is btw. what
localectl also does), because we were *only* matching rules but not
symbols, so using "eu" as a layout won't work either.

I decided now it's the time to actually use libxkbcommon to try
compiling the keyboard options and see whether it succeeds. This comes
in the form of a helper tool called xkbvalidate.

IMHO this approach is a lot less error-prone and we can be sure that we
don't forget about anything because that's what the X server itself uses
to compile the keymap.

Another advantage of this is that we now validate the full set of XKB
options rather than just the layout.

Tested this against a variety of wrong and correct keyboard
configurations and against the "keymap" NixOS VM tests.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @lheckemann, @peti, @7c6f434c, @tohl, @vcunat, @lluchs
Fixes: #27597
2017-07-28 12:39:55 +02:00
..
applications anydesk: init at 2.9.4 2017-07-28 16:05:35 +08:00
build-support makeImageFromDebDist: Add extraDebs arguments 2017-07-27 20:34:24 +02:00
common-updater
data Merge pull request #27488 from dywedir/emacs-all-the-icons-fonts 2017-07-19 23:06:09 +01:00
desktops Revert "stdenv: Store one package per line in nix-support/propagated-*" 2017-07-24 01:05:30 -04:00
development rustracer: 2.0.6 -> 2.0.9 2017-07-28 11:58:31 +02:00
games Merge pull request #27687 from elitak/factorio-version 2017-07-28 05:44:28 +01:00
misc Merge pull request #27705 from binarin/dosbox-unstable-init 2017-07-28 11:38:32 +02:00
os-specific Merge pull request #27639 from jfrankenau/update-firejail 2017-07-28 05:45:57 +01:00
servers ejabberd: 17.01 -> 17.07 2017-07-27 17:07:45 +03:00
shells bash-completion: 2.5 -> 2.7 2017-07-19 23:58:53 +02:00
stdenv stdenv/setup.sh: undo local -n change 2017-07-24 13:09:32 -04:00
test
tools nixos/xserver: Properly validate XKB options 2017-07-28 12:39:55 +02:00
top-level nixos/xserver: Properly validate XKB options 2017-07-28 12:39:55 +02:00