I tried to activate my custom keyboard layout via the method explained in the Advanced section of Keyboard Layout Customization - NixOS Wiki.
Unfortunately it didn’t work.
If I execute the xkbcomp command directly on my terminal with the same layout.xkb file it works.
What I have currently in my configuration.nix is this:
displayManager.sessionCommands = ''
${pkgs.xorg.xkbcomp}/bin/xkbcomp ${/configuration/layout.xkb} $DISPLAY
'';
My layout.xkb file looks like this:
xkb_keymap {
xkb_keycodes { include “evdev+aliases(qwerty)” };
xkb_types { include “complete” };
xkb_compat { include “complete” };
partial alphanumeric_keys
xkb_symbols "thomad" {
include "pc+at+us:2+inet(evdev)+terminate(ctrl_alt_bksp)"
name[Group1] = "German (Austria, thomad)";
key.type[Group1] = "FOUR_LEVEL";
key <AC01> { [ a, A, braceleft, NoSymbol ] };
key <AC02> { [ s, S, braceright, NoSymbol ] };
key <AC03> { [ d, D, bracketleft, NoSymbol ] };
key <AC04> { [ f, F, bracketright, NoSymbol ] };
key <AC05> { [ g, G, backslash, NoSymbol ] };
};
xkb_geometry { include "pc(pc104)" };
};
I also tried Custom Keyboard Layout on NixOS, revisited which I found quite nice because it’s better integrated. But the rebuild is too time consuming and it didn’t work for me either.