'nixos-generators` questions

I’ve been working to migrate some configs for vagrant boxes over to nix based configs with nixos-generators and was looking some pointers.

First, when I build with -f vagrant-virtualbox the .box file does not seem to be “portable”. If I copy it out of the store to a windows machine, and try to vagrant up with it the unpack phase fails with a missing file. I’ve been getting around it by manually using vagrant package on the box nixos-generators makes which does work on the windows machine. However, this is quite a bit slower than just directly moving the box. Is this typical?

Also, just building a box is pretty slow on my machine, are there any tips for iterating quickly on the configuration without having to build a full box?

I don’t know if anyone else has interest, but just as a brief update, I’ve found that using the vm target caches much better and so is much faster than the vagrant-virtuabox one so I’ve been using that for iterating.

The portability issue is still an open problem for me. My work around has been to fire up the box that nixos-generators makes with vagrant on the NixOS machine that made it (where it works), then use the vagrant package command to make a new box from that which I can then move to Windows. This is obviously pretty sub optimal though, so I’d like to see if it can be fixed in nixos-generators. Next time I’m at the Windows machine which is giving the error I’ll copy it down and open a Github issue. My recollection was that it seemed like it was trying to pull something from the store which is obviously not available once the machine leaves the NixOS box which created it, but I don’t recall specifically what.

The other ergonomic issue with all this is that nixos-generators needs KVM kernel modules installed to run, but vagrant needs virtualbox drivers. So going through the above manual process involves switching to KVM kernel modules to run nixos-generate then switching back to virtualbox kernel modules to run vagrant and back and forth as needed to iterate. I don’t understand how nixos-generators is working under the hood, but it would be nice if it could use the virtualbox kernel module when generating vagrant-virtualbox images.