News for hackers. Stuff that matters.
Re:NixOS 22.11 “Raccoon” Released by ochoseis on Thursday December 01, 2022 @10:03AM (#33817110)
How are you managing the VM’s on NixOS?

A couple years ago I was searching for a good way to declaratively manage them, and the best I came up with was libvirt + terraform + nixos-generators for images. It feels like you should just be able to set them up as systemd units, but I couldn’t figure it out.

microvm has caught my eye recently but I haven’t played with it yet: https://github.com/astro/microvm.nix

Re:NixOS 22.11 “Raccoon” Released by amarshall on Thursday December 01, 2022 @12:28PM (#33819461)
Not OP (and I suspect they don’t have what you’re looking for since they have stated they treat the VMs as pets, not cattle). I currently use libvirt, but I eschew persistent VMs and instead build the libvirt domain XML with Nix, and then start VMs with `virsh create /path/to/myvm.xml`. Using an absolute path means that libvirt will not persist the domain, and makes it easier to declaratively manage the config with Nix.

However, none of my VMs are always-on, so I don’t have to deal with restarts on config change. That said, when libvirt isn’t managing the lifecycle of the VMs as much, writing a systemd unit should be quite a bit easier.

Re:NixOS 22.11 “Raccoon” Released by madjam002 on Thursday December 01, 2022 @02:51PM (#33821730)
The VMs themselves are a mix of some manually created ones (the VM configs are still NixOS though), and some IaC VMs which I just use Terraform and the libvirt provider. It's a bit clunky but I wouldn't want to embed the VM config in the hypervisor configuration as the VMs can be live migrated to other hypervisors.

MicroVM looks awesome though, thanks for the pointer!

Re:NixOS 22.11 “Raccoon” Released by ochoseis on Thursday December 01, 2022 @05:54PM (#33824156)
Did you manage to get live migration working with the terraform provider? As of a while ago it wasn’t implemented but idk if that’s changed: https://github.com/dmacvicar/terraform-provider-libvirt/issu...