Browsers freeze/crash in NixOS VM on Apple Silicon Mac (aarch64-darwin host, aarch64-linux guest)

Hi,

Bit of a niche use-case. I’m trying to get a web browser (chromium, firefox, or epiphany) working in qemu on macos.
My nixosConfiguration looks like this at the moment

...
      nixosConfigurations.testvm = nixpkgs.lib.nixosSystem {
        system = "aarch64-linux";
        specialArgs = { inherit inputs; };
        modules = [
          (
            {
              modulesPath,
              config,
              pkgs,
              ...
            }:
            {
              imports = [
                (modulesPath + "/virtualisation/qemu-vm.nix")
                (modulesPath + "/../tests/common/x11.nix")
              ];

              # Override to login as root instead of the default
              test-support.displayManager.auto.user = "root";

              # Enable D-Bus
              services.dbus.enable = true;

              virtualisation.memorySize = 1024 * 8;
              virtualisation.cores = 4;
              virtualisation.host.pkgs = nixpkgs.legacyPackages.aarch64-darwin;

              environment = {
                systemPackages = with pkgs; [
                  epiphany
                  chromium
                  firefox
                  dbus
                  xterm
                ];
              };

            }
          )

        ];
      };
...

When I run nix run .#nixosConfigurations.testvm.config.system.build.vm, a qemu window starts and boots into the window manager, but when I start any of the browsers, the system hangs completely, and doesn’t do anything. I don’t get anything useful out in the console.

So far I’ve tried –disable-gpu –no-sandbox, LIBGL_ALWAYS_SOFTWARE=1, various QEMU video options (-vga std), and different memory/CPU allocations.
Nothing has worked.

The only success I’ve had has been getting a screenshot from chromium in headless mode:
chromium --no-sandbox as root --headless --disable-gpu --screenshot=/tmp/test.png --window-size=1280,720

Does anyone have any debugging ideas or solutions? I assume this is to do with hardware acceleration/relatively high resource requirements from browsers, not being supported in qemu on macos, but can’t seem to get anywhere. Could it be a bug? Or just not possible with qemu?

Thanks