0

How can I set layout toggling on <win+caps> in NixOS configuration.nix only?

  • Are you referring to Xorg keyboard options? For example, I use configuration.nix to set up ALT+SHIFT to toggle the keyboard language between English and Thai. – Emmanuel Rosa Mar 09 '19 at 12:42
  • @EmmanuelRosa It could be easily done with just setting services.xserver.xkbOptions to "grp:win_caps_toggle", but first custom win_caps_toggle option should be defined; here is the answer how to do it, but can it be done in configuration.nix only? BTW saw your vids about NixOS installation. – Anonymous Mar 09 '19 at 21:18
  • Oh, thanks for watching! Here's the scoop. There's no built-in way in NixOS options to modify the files described in the answer you linked to. It can be done, but there's one piece I don't know how to do. Basically, you need to create a derivation which contains "${pkgs.xkeyboard_config}/etc/X11/xkb}" plus the files you need to override; namely share/X11/xkb/symbols/group and share/X11/xkb/rules/evdev.lst. To do this you need the nixpkgs function which recursively symlinks a tree of files. For the life of me, I cannot remember the name of this function.... – Emmanuel Rosa Mar 12 '19 at 14:45
  • ...With that in place then set services.xserver.xkbDir to the output of said derivation. When Xorg runs it will use the xkbDir for keyboard settings. Since it would point to the same files it currently does (due to the symlink-ing) PLUS the custom files you provide, that should allow you to use <win+caps> in NixOS with configuration.nix. The final step is setting services.xserver.xkbOptions = "grp:win_caps_toggle"; Overall, this will require some troubleshooting, hence I recommend asking in the NixOS Discourse community or on IRC. – Emmanuel Rosa Mar 12 '19 at 14:50

0 Answers0