Skip to content

Commit

Permalink
xserver service: xkbvalidate: Respect xkb.dir. Fixes #31138.
Browse files Browse the repository at this point in the history
Until now, if you set `services.xserver.xkb.dir` to a dir containing
a custom keyboard layout, and making this layout the default via
`services.xserver.xkb.layout`, `xkbvalidate` would complain:

    The value `gb-CapsLockIsHyperL' for keyboard layout is invalid.

    Please check the definition in `services.xserver.xkb.layout'.

    Detailed XKB compiler errors:

        Couldn't find file "symbols/gb-CapsLockIsHyperL" in include paths
        1 include paths searched:
            /nix/store/x1ahkafwzv66s3yxffvrjc0ixkcjiig6-xkeyboard-config-2.31/etc/X11/xkb
        3 include paths could not be added:
            /homeless-shelter/.config/xkb
            /homeless-shelter/.xkb
            /etc/xkb
        Abandoning symbols file "(unnamed)"
        Failed to compile xkb_symbols
        Failed to compile keymap

This is because the `xkb_*()` functions in `xkbvalidate` were not
told to use our `xkbDir`.

This commit fixes it by passing the dir as an environment variable
as described on:

* https://xkbcommon.org/doc/current/group__include-path.html
* https://xkbcommon.org/doc/current/group__context.html
  • Loading branch information
nh2 committed Dec 10, 2023
1 parent 2c7f3c0 commit f757546
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nixos/modules/services/x11/xserver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -804,14 +804,14 @@ in
];

system.checks = singleton (pkgs.runCommand "xkb-validated" {
inherit (cfg.xkb) model layout variant options;
inherit (cfg.xkb) dir model layout variant options;
nativeBuildInputs = with pkgs.buildPackages; [ xkbvalidate ];
preferLocalBuild = true;
} ''
${optionalString (config.environment.sessionVariables ? XKB_CONFIG_ROOT)
"export XKB_CONFIG_ROOT=${config.environment.sessionVariables.XKB_CONFIG_ROOT}"
}
xkbvalidate "$model" "$layout" "$variant" "$options"
XKB_CONFIG_ROOT="$dir" xkbvalidate "$model" "$layout" "$variant" "$options"
touch "$out"
'');

Expand Down

0 comments on commit f757546

Please sign in to comment.