How to fix build errors on other architectures?

One of the most frustrating, because hardest to fix, problems is when you have a PR which works on your machine, but it fails on CI on a different architecture. (Typically darwin.) Latest example: rabbitmq-server: switch to python3 by armeenm · Pull Request #169684 · NixOS/nixpkgs · GitHub

I don’t know what to do there. I’m on a x86_64-linux, without a darwin machine I could use to debug. Debugging by pushing onto the branch and using CI takes forever and uses a lot of precious resources (darwin runners). Bisecting & testing small changes is impossible that way. Just merging without understanding what happened is also not ok in my opinion.

Is it possible to easily emulate other architectures somehow? Is there a framework to do that?

I have the feeling this happens a lot, and not just to me. A lot of PR progress is impeded by “I don’t have a darwin machine to test, no idea what’s wrong here”.


If there’s a darwin-related issue, ping the NixOS/darwin-maintainers team on GitHub. Someone should (hopefully) be able to help.

Unhelpfully, the problem appears to be x86_64-darwin only. It builds fine on aarch64-darwin. I posted a few responses to the issue.


You should be able to emulate the architecture you want to build for.

In configuration.nix:

boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

Then just initialize a shell with nix develop .#devShell.aarch64-linux and build your project.
Of course, replace aarch64-linux with your architecture.

1 Like

Any Apple stuff is basically always going to be difficult and illegal if you don’t have Apple hardware, and that’s by design. So I second pinging the Darwin maintainers. Another option I’ve used in a pinch is GitHub Actions, which has free* (~for usage on open source projects) macOS virtual environments. Still takes some time of course, but you’re wasting Microsoft’s resources instead :sunglasses:.

Hosted by Flying Circus.