Whenever I run nixos-rebuild switch while on a specialisation, I seem to lose any config that was made specifically on said specialisation.
For example, if using my gpu passthrough setup and switching, I will lose access to programs like virt-manager, virsh, etc etc until I reboot and select it again.
Is this some kind of limitation or can the behaviour be changed?
nixos-rebuild switch runs <toplevel>/bin/switch-to-configuration boot && <toplevel>/bin/switch-to-configuration test. The first command is correct, while you need your specialisation’s switch-to-configuration (<toplevel>/specialisation/<spec-name>/bin/switch-to-configuration test).
You can manually run these scripts out of your system’s toplevel, which you can build with nixos-rebuild build, but the API might change.