3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services/x11
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
..
desktop-managers lumina: 1.2.0-p1 -> 1.3.0 2017-06-29 08:13:09 -03:00
display-managers qt58: determine plugin and import paths from PATH 2017-06-18 08:44:47 -05:00
hardware treewide: use boolToString function 2017-04-11 18:18:53 +02:00
window-managers qtile: Fix using qtile together with desktop 2017-05-31 18:37:47 +03:00
colord.nix colord service: init 2016-03-11 01:58:40 +03:00
compton.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
redshift.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
terminal-server.nix nixos: update default cases from KDM/KDE4 to SDDM/KDE5 2017-02-09 21:52:00 -05:00
unclutter-xfixes.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
unclutter.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
urxvtd.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
xautolock.nix services.xserver.xautolock: add module 2017-05-09 15:02:10 +02:00
xbanish.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
xfs.conf
xfs.nix jobs -> systemd.services 2016-01-07 06:39:06 +00:00
xserver.nix nixos/xserver: Properly validate XKB options 2017-07-28 12:39:55 +02:00