Nixos-rebuild build-vm not portable across linux distributions?

I’m trying to get help debugging a Nix specific emacs issue with the tramp library.

The tramp maintainer was never able to reproduce my issue, so I made a virtual machine image from a Nix flake where the issue can be reproduced.

The plan was for the tramp maintainer to use the generated qcow2 image, but it wasn’t enough for him from Fedora to do:

 sudo virt-install --name NixOS --memory 4096 --vcpus 2 --disk 
/home/albinus/Downloads/Rick.qcow2,bus=sata --import --os-variant nixos-unknown 
--network default

Because after he receives error:

No bootable device.

For full context, see the mailing list thread.

I don’t have a ton of experience with qemu or know how to get an image working from another OS.

Can anyone help me out or give guidance?

No, IIRC the image doesn’t include any derivation and shares the /nix/store with the host machine. Essentially it’s just the disk state.

If you want to make an image to share with a non-NixOS user you should do something like this:

nix build -f '<nixpkgs/nixos>' -I nixos-config=configuration.nix

This will build a full image, including the Nix store in the OVF format.


What is to be done to get the virtualBoxOVA attribute available?
(only got .vm)

nix build -f '<nixpkgs/nixos>' -I nixos-config="${dirPath}/${fileName}.nix"
error: attribute 'virtualBoxOVA' in selection path '' not found

Oh sorry, you need to import this module in the NixOS configuration: