Test an aarch64-linux VM wayland compositor from an x86_64-linux host

I finally figured it out:

  1. First, at least for pinnacle, seatd has to be enabled:
services.seatd.enable = true;
  1. The following qemu launcher config is needed:
                virtualisation.vmVariant.virtualisation.qemu.options = [
                  "-display gtk,gl=on"
                ];
  1. Along with the following override:
          }).config.system.build.vm.overrideAttrs
            (oldAttrs: {
              # From some reason adding another -device makes pinnacle not
              # launch, so we substitute the gpu device with an opengl enabled
              # device manually. TODO: Fix this in Nixpkgs more elegantly.
              buildCommand = oldAttrs.buildCommand + ''
                # Remove a symlink and substitue the contents of it with out
                # virtio-gpu-gl-pci fix
                original=$(readlink $out/bin/run-*)
                basename=$(basename $out/bin/run-*)
                rm $out/bin/run-*
                substitute "$original" "$out/bin/$basename" \
                  --replace-fail virtio-gpu-pci virtio-gpu-gl-pci
                chmod +x $out/bin/run-*
              '';

The full config example at this point in time is available here:

https://gitlab.com/doronbehar/nixos-configs/-/lob/78e711e99b6f5bd9b7fd340d46be690e191db6a4/flake.nix#L241-289

I hopefully will post a link to the GitHub PR that will fix this once I got it ready.