First, scan through these helpful links:
- https://www.reddit.com/r/linux_gaming/comments/nypsi1/updated_guide_to_remapping_keys_on_linux_using/
- https://github.com/systemd/systemd/blob/main/hwdb.d/60-evdev.hwdb
- https://search.nixos.org/options?channel=23.11&show=services.udev.extraHwdb&from=0&size=50&sort=relevance&type=packages&query=hwdb
This is what I ended up adding to /etc/nixos/configure.nx file.
This is specific to the keyboard that is in my laptop. Unless you also
have the same basic US keyboard they shiped with my framework 13 (circa April
2024), you will want to modify this udev rule accordingly. The information
on how to do that can be found in the reddit post and 60-evdev.hwdb
file
linked above.
services.udev.extraHwdb = ''
# This swaps the position of the insert and delete keys, but only
# for this laptop's keyboard in specific.
# I: Bus=0011 Vendor=0001 Product=0001 Version=ab83
# N: Name="AT Translated Set 2 keyboard"
#evdev:input:b0011v0001p0001eAB83*
evdev:name:AT Translated Set 2 keyboard:*
KEYBOARD_KEY_d2=delete
KEYBOARD_KEY_d3=insert
'';
Once you're all set and filled with excessive confidence, run the usual
sudo nixos-rebuild switch
and reboot.