vm-builder #
Builds the monochromatic-dev container image, converts it to a qcow2 disk image, and imports it as a libvirt VM accessible from virt-manager.
Prerequisites #
Install these on the host before running:
sudo dnf install podman libvirt-client virt-install
sudo usermod -aG libvirt $USER # re-login after this
The scripts define the VM through qemu:///session;
root privileges are still
needed for copying the qcow2 into /var/lib/libvirt/images/.
Usage #
mise run //package/dev-script/vm-builder:run
The script runs four steps in sequence:
- Build:
sudo podman buildproduceslocalhost/monochromatic-dev:latestfromContainerfilein rootful storage for bootc-image-builder compatibility - Convert:
bootc-image-builderconverts the image tooutput/qcow2/disk.qcow2(rootfulsudo podman, privileged) - Fix ownership:
restores
output/from root: root to current user - Import:
virt-install --importregisters the qcow2 as a libvirt domain
After the script finishes, start the VM:
virsh --connect qemu:///session start monochromatic-dev
# or open virt-manager and double-click the VM
Re-running #
The script is idempotent.
If a VM named monochromatic-dev already exists,
it is forcibly stopped and undefined before the new image is imported.
The output/ directory is recreated if absent.
Configuration #
VM defaults (edit src/build-and-import.ts to change):
- Memory: 16 GiB
- vCPUs: 8
- Disk:
output/qcow2/disk.qcow2(qcow2, grown from 40 GiB root) - Network:
default(NAT via libvirt) - Display: SPICE + QXL
Disk layout is controlled by disk_config/disk.toml.
See the TODO comments in that file for ZFS encryption status.
Files #
Containerfile: OS image definition (ucore-hci base, KDE, apps, dev tools, user, mise, dotfiles)disk_config/disk.toml: bootc-image-builder disk layoutsrc/build-and-import.ts: orchestration scriptoutput/: build artifacts (gitignored)