NixVirt: manage virtual machines

NixVirt provides a NixOS module and a Home Manager module for defining virtual machines (known as “domains”) and networks using libvirt.

Whereas existing NixOS allows you to control the libvirtd daemon, NixVirt allows you to specify domains using libvirt’s XML definition format, and whether they should be running. You can use these domains with libvirt clients such as virt-manager or GNOME Boxes.

I am currently working on providing Nix functions to generate these XML definitions from Nix structures, for a more Nix-like experience.

26 Likes

How come you’re not using builtins.toXML?

builtins.toXML generates XML in Nix’s own XML schema (for Nix structures). It cannot create XML in libvirt’s domain definition or network definition XML schemas.

5 Likes

Awesome project, this has been a pain point in Nix for me so far! Do you have any example configurations?

No, but you can obtain XML files for your domains using virsh dumpxml.

1 Like