Declaritive configuration for setup of qemu/kvm/virt-manager

I’ve been hunting for thoughts on setting up qemu/kvm/virt-manager.

When I say setting up, I mean after it is installed what is the recommended ‘NixOS’ way to declare ‘preferences’ and configuration in an idempotent way.

For example if you want to change the grab/ungrab key for virt-manager, the normal imperative method would be to launch the Virtual Machine Manager GUI, go to Edit\Preferences\Console and change it from there.

With setting up virtual networks, it would be open the same GUI and go Edit\Connections Details\Virtual Networks and add as required.

I haven’t found a heap of NixOS options to perform this setup from configuration.nix.

Currently I have a ShellScript that is created by my config that creates XML files and uses virsh to create the networks that I need. Me running it when required makes it idempotent but I could do a conditional test in a system.activationScript to fully automate. I’m just wondering how others do it?