I’m trying to set a different layout for the built-in keyboard of my laptop and an external USB keyboard in the same way that I’ve done so in the past on Debian, and it’s not working. I’m not sure if this is because there’s some extra interaction between the udev env in Debian that is not in NixOS or because I’m doing something else wrong. Here’s my config snippet:
services.udev = {
extraRules = ''
ATTRS{idVendor}=="cb10",ATTRS{idProduct}=="4256",ENV{XKBLAYOUT}="us",ENV{XKBVARIANT}="colemak"
'';
};
In this case I’m setting the variant to colemak, not because I want colemak but just to confirm that the setting is making it through. I’ve confirmed with udevadm that the env vars are getting set on the device. It is not being picked up by X, however.
Instead, X is using the layout set in /etc/X11/xorg.conf.d/00-keyboard.conf
. By default, that sets XkbVariant
to ""
- an empty string. I can also set it in my configuration.nix using services.xserver.xkb
. Whether I set it explicitly or not, it uses these settings instead of the udev ones.
What I want is for the built-in keyboard to use Dvorak and for all other keyboards to use QWERTY, since my external keyboards have the layouts customized in firmware. I would prefer not to do this by automating some script to run after it’s bound (which would then run setxkbmap
or something), but rather I’d like to configure the things which talk to the input devices, like X, Wayland, and the console. Unfortunately, the docs for the libinput X driver are basically… missing? So far as how keyboards are handled. There’s nothing about config.
Maybe I should give up on input libraries making sense and just directly configure the laptop keyboard, it’s a Framework 16 so it has QMK…