I followed the instructions at this email thread, and placed
services.xserver.xkbOptions = "grp:alt_space_toggle, ctrl:swapcaps";
in my /etc/nixos/configuration.nix file, but even after rebuilding with $ nixos-rebuild switch, and rebooting with nixos-rebuild boot and reboot, my caps lock key is not remapped.
How to map caps-lock to ctrl in nixos?