libvirt
libvirt is a toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). It does so by providing a common API to different virtualization backends.
Using the virtualisation.libvirtd
options, libvirtd can be enabled on a NixOS machine.
Backends
QEMU/KVM
This backend works and is enabled by default. To use virt-manager
with your user, locally and via SSH, it will be necessary to add yourself to the libvirtd
group.
Tools
NixOS provides some packages that can make use of libvirt or are useful with libvirt.
libguestfs
libguestfs is a set of tools for accessing and modifying virtual machines disk images.
Following are notes regarding the use of some of those tools
virt-builder
virt-builder is installed with libguestfs
, but has some issues from its packaging.
It is possible to work around those issues without modifying the package (when a pristine nixpkgs is needed).
$ mkdir -p ~/.config/virt-builder
$ cd ~/.config/virt-builder
$ ln -s /run/current-system/sw/etc/xdg/virt-builder/repos.d
$ cd ~/.config
$ ln -s virt-builder/ .virt-builder-wrapped
This will make your user use the shipped repo configurations, and works around the fact that virt-builder reads its executable name to build its configuration path. The executable being wrapped, it is named differently.