Nixos/modules/virtualisation/qemu-vm.nix is confusing

Are we…creating a VM for a NixOS image from within the configuration of that image? That seems very confusing. Don’t we want to pass a whole configuration to a non-nixos module that makes the VM image? Or at the various least, we have a separation of “things that need to be inside the image, part of the configuration” vs “building the image and packaging it up, downstream of the image”.

2 Likes

Ah, so the original sin here is that many modules are using make-disk-image.nix, but the application of that to some config should be downstream of the NixOS config. Likewise, for anything that depends on on that function application.

So it should be roughly

let image = import ./make-disk-image.nix (evalModules ....);
in doStuff