Declarative hypervisor?
Is there a declarative way to manage NixOS virtual machines? What I have in mind: A configuration DSL where you can specify what virtual machines you want and the resources needed for each virtual machine and a process that creates the virtual machines from this specification. So, something like NixOps except that it doesn't try to sync the configuration with some external hypervisor, but is the hypervisor itself (on bare metal). That way you could have a git repository with the current configuration and a CD pipeline that creates the machines (and the entire thing would just work without constant babysitting).
I expect the answer is no, because I couldn't find anything, but you never know :)
Posted Nov 16, 2021, 6:41 PM UTC · edited
Check out https://github.com/Nekroze/vms.nix. It tries to give you an interface similar to oci-containers (aka declarative docker containers under NixOS, see [1]), but using qemu-based VMs instead.
1: https://search.nixos.org/options?channel=21.05&from=0&size=50&sort=relevance&type=packages&query=oci-containers
This looks pretty good, I don't think I can replicate my current setup with it just yet, but it seems like a nice starting point. Taking libvirt out of the equation is definitely the step in the right direction. Thanks :)