nixos-generators icon indicating copy to clipboard operation
nixos-generators copied to clipboard

Question: using vm-nogui format, can you emulate an aarch64 guest on an x86 host?

Open AydinGokce opened this issue 2 years ago • 0 comments

Title sums it up.

I'm using nixosGenerate in a flake. Given a minimal example as such:

  mkVmImage = modules:
    nixos-generators.nixosGenerate {
      modules = modules;
      system = "...";
      format = "vm-nogui";
  };

This appears to always produce a run script and guest kernel/initrd for the same architecture. I.e. if system is x86_64-linux, the resulting executable bash script (something like run-nixos-vm) will be built to run on an x86_64-linux host and emulate an x86_64-linux guest VM, likewise for aarch64-linux. In my use case, I would like to have a runner script that runs on x86_64-linux, which emulates an aarch64-linux guest machine. Is it possible to achieve this using format = "vm-nogui"?

I'm guessing my best option would be to generate an aarch64-linux image in a qcow2 format, and make my own script to emulate it with qemu-system-aarch64, however I just wanted to check.

Thank you for the help! I apologize if this is a naive question.

AydinGokce avatar Jun 16 '23 19:06 AydinGokce