I stumbled upon your question as I was looking for something similar. Continuing the search, I ended up boiling it down to the following options:
- Use
libvirt
as described in Libvirt - NixOS Wiki : with the NixOS module to setup the host, and leveragevirsh
to manage networks and clients; -
NixVirt (from @AshleyYakeley) that seems to allow to declaratively manage networks and clients (domains in
libvirt
terminology) through XML; -
MicroVM.nix (from @astro) that seems to provide another layer of abstraction for declaration as
nix
code, supports multiple virtual machines backends (hypervisor-ish), and also ships a module for managing the running of said VMs on a host - c.f. NixCon 2023 presentation.