Feedback about running Home Assistant using NixVirt declaratively

Hey folks, I’ve started playing with nixos a few weeks ago and in the meantime was planning on moving my home-assistant installation from docker to HAOS as support is much stronger there.

Looking at the wiki I was surprised that there was no declarative howto of running it on a VM, instead both options rely on using nixos to set up libvirt/incus and then installing the VM manually.

I’ve spent a couple days playing with NixVirt and although it was not easy as there’s many silent failures I’ve managed to put up a module that spins the VM declaratively.

It didn’t make my effort easier, but I decided that I didn’t want to use any storage pools or linux bridges, so I had to override many of the default nixvirt template bits to use a macvtap interface and set a scsi controller.

home_assistant.nix

I wanted to gather feedback here on what I could do better here. Maybe this can grow to be part of the tutorial on the wiki. I would probably either ask or try to add some of the necessary changes in NixVirt first though as it could simplify it quite a bit.