3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules
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
..
config change swap.randomEncryption config option to "coercedTo" for backwards compatibility 2017-07-26 20:57:10 +03:00
hardware mcelog: use .service file from upstream 2017-07-27 13:06:20 +08:00
i18n/input-method Remove top-level kde5 attribute 2017-02-27 11:49:10 -06:00
installer nix: 1.11.12 -> 1.11.13 2017-07-18 10:54:01 +02:00
misc Merge pull request #26907 from volth/vault 2017-07-11 15:02:29 -04:00
profiles all-hardware.nix: add VMware support. (#27430) 2017-07-17 02:38:10 +02:00
programs Merge pull request #26761 from gnidorah/master3 2017-07-26 22:44:45 +08:00
security nixos/auditd: init at 2.7.6 (#27261) 2017-07-09 17:59:09 +01:00
service-managers Simple proof of concept for how to do other types of services 2017-05-26 18:14:31 -04:00
services nixos/xserver: Properly validate XKB options 2017-07-28 12:39:55 +02:00
system swap: extend randomEncryption to plainOpen and ability to select cipher 2017-07-26 20:57:10 +03:00
tasks zfs, spl: 0.6.5.11 -> 0.7.0 2017-07-27 19:00:54 +02:00
testing kdm: drop service 2017-02-11 13:55:09 -05:00
virtualisation docker module: fix autoPrune.enable description 2017-07-21 16:54:40 +02:00
module-list.nix Merge pull request #27347 from cstrahan/osquery-new 2017-07-24 21:51:10 -04:00
rename.nix zfs, spl: 0.6.5.11 -> 0.7.0 2017-07-27 19:00:54 +02:00