Newbie needs advice & direction: custom keyboard layout


I am arch user, I am evalutating nixos for migration. I have lots of special configurations that I manage with many scripts and ansible provisioning. I have several computers and keeping them in line is getting hard.

I would like to know if I can do one crucial thing for me in nixos for the start.

I am using custom keyboard designed according to my needs, I am using custom X configuration files to do that. I need to be able to replicate this in nixos to be able effectively use the os.

Following is the list of files that I replace in the X system at /usr/share/X11 in a standard arch based system. Some of the files are original system files that came with arch system, some of them are my addition. I marked custom files with “custom” word. These files are ready, I just copy them when there is change in the system files after an update. I have also configuration statements in mkinicpio.conf file to pack these for taking into consideration when creating boot image so that I can type this custom keyboard at luks login and initial console login.

├── kbd
│ ├──
│ ├──
│ └──
└── xkb
├── keycodes
│ └── evdev
├── rules
│ ├── base.lst
│ ├── base.xml
│ └── evdev.xml
└── symbols
└── custom

I am planning to write a pacman hook to do this automatically, instead of script with which I am currently using after every system update when those files are updated.

I understand the nixos concept, read the nix manual mostly but have not attempted to install system yet, actually tried to install it, but gave it up quickly because I could not change keyboard locale and I did not have latin1 keyboard with me at the time.

I appreciate any guidance, about how I can achieve this in nixos. Proper way of doing this arch system is most likey via a pacman hook along with installing a custom pacman package on top of X package after every update of it.

Just for the start, until finding a better solution via nix in nixos, can I just copy files to proper places in nixos? If so how can I do it? I have the impression that files must be somehow generated instead of copy.

I just need to be able to use my keyboard for even installing the system. I am using a enhanced, modified existing layout, and in arch I can change keyboard layout to this already existing layout with minimal typing. However in nixos, I need modify configuration.nix for the layout and update system as far as I can understand.

Thank in advance.

Nixos is very customizable and including your own config files is certainly possible.

Regarding the workflow: Yes, a running NixOS system is pretty immutable. You write your config, you buid your system and when you’re ready to do so, you simply flick the switch and use your new system. And if there are problems, you can simply flick the switch back and have your previous system.

You can switch your keyboard layout temporarily as you would do on other systems.

A suggestion for a smooth move: Start with home-manager and/or set up NixOS in a VM.