Colemak Mods Implementation

I am trying to port over all the important Colemak mods, these include Curl, Angle, Wide, Symbols and others, and help would be much appreciated.

The repository contains shell scripts and XKB Configuration Files.

Should the mods be included in one big meta-package? Or should the mods be available as individual packages? Should we patch the XKeyboardConfig derivation?

If you can help in any way possible, feel free to reply!

1 Like

For now, on nixos-unstable, services.xserver.extraLayputs seems to be broken, as is patching xkeyboard-config in xorg itself. First we need to fix that, and then we could implement a way to specify the desired keyboard configuration, in the same way DreymaR’s scripts do it, but in Nix as an override.

I managed to get a modified version of DreymaR’s script to work. If anyone is interested, check out my repository.

This is only tested on nixos-20.09. If it works for anyone on nixos-unstable, please tell me.

1 Like

Can you tell me what’s wrong with xserver.extraLayouts? As far as I now, it’s working perfectly fine as of NixOS 20.09.

You should be able to load any xkb symbols, geometry, keycodes, etc. files, as described in the manual, and the layout will be able to load it via setxkbmap or the xserver.xkb* options.

To be honest, I didn’t think it would work, so I didn’t test it. I’m doing that now.

My reason was, if I ever wanted to change the layout, I would have to rerun the script and replace the xkbSymbols file. It’s not a valid reason though, as all mods are implemented in the colemak symbols file.

I replaced all the overrides with this code in services.xserver:

extraLayouts = {
  colemak = {
    description = "DreymaR's Colemak mods";
    languages = [ "eng" ];
    symbolsFile = /etc/nixos/xkb/colemak;
  };
  ro = {
    description = "Romanian modded with Colemak";
    languages = [ "rum" ];
    symbolsFile = /etc/nixos/xkb/ro;
  };
};

The files get where they should, and all seems okay.
However, besides

xkbModel = "pc105aw-sl";
xkbOptions = "misc:cmk_curl_dh";
xkbVariant = "cmk_ed_ks";

not working, I can’t set those with setxkbmap either, like I could when overriding.

EDIT: It seems the script also modifies keymaps, rules, geometry and types, apart from symbols. And not just one file. Even after including (most of) everything, it still doesn’t work. Maybe I’m not digging deep enough…

DreymaR merged my fork, so now everyone can use the main repo.

1 Like

Hi @fufexan

Can you explain how to use dreymar’s repo with your changes? I’m pretty new to NixOS, but I looked at the merge of your fork and saw the additions of “-s” for NoSudo and “-c” for the path of X11.

I cloned Dreymar’s repo to ~/projects and used:
bash install-dreymar-xmod.sh -s -n -- 4cw us us

With the following output:

@@@ DreymaR’s Big Bag Of Tricks install script (by GadOE, 2016-06) @@@
¤ Found mod root dir ‘./xkb-data_xmod’
¤ Subdirectories to mod: ‘xkb’
¤ Backing up: None
¤ Not using sudo.
¤ Replacing files in ‘/usr/lib/X11/xkb’ with mod

@@@ install-dreymar-xmod.sh - ERROR: System files copy error! @@@

I am in the process of trying to understand Keyboard Layout Customization - NixOS Wiki
Hope I’m on the right track, can’t figure out how to use the “-c” to point to the path of X11. Help is appreciated!

The reason the patching doesn’t work the way you did it, is that files in the nix store are read only and can only be written during a package install / system rebuild. Simply calling that command in a terminal won’t work since it can’t find the xkb files and even if it somehow finds them, it can’t write to them. That’s why the command only works when inside a derivation.

In one of my previous replies I linked a file from my config. Since then the patch broke, probably as a consequence of some nixpkgs change. I never really looked into it because imo it’s a waste of time.

Even though it’s been linked already, I’ll link it again: https://github.com/fufexan/dotfiles/blob/622319a211b5f60feadded305b39de96d9af22df/modules/legacy/keyboard_patching.nix. This time it has an explanation of the state of it and possible further steps to follow that may aid in solving the issue.

I recommend writing a xserver.extraLayouts entry manually, as it is sure to work and not cause any problems in the future. If it helps, I’ll also link the file I used that added Mod DH on top of the us colemak layout. It’s here.

It may need a few modifications as it is probably using the old DHk instead of the newer DH standard.