nix run works on macOS, however because it's built against our host system the binary fails inside of a container:
$ nix run
2023-10-30T14:53:25.596675Z WARN No .env found
[...]
$ nix build ".#dockerImage" && ./result | podman load
$ podman run mercury
{"msg":"exec container process `/nix/store/zi27abixfpaq0x4czinw34dyjwvb7lrb-mercury-0.0.0/bin/mercury`: Exec format error","level":"error","time":"2023-10-30T14:55:01.480708Z"}
We could potentially use crossSystem^1, however that loses access to the Nix binary cache, meaning we end up building the universe.
Thus our options for building the container on macOS are:
Building the universe.
Running an entire Linux container locally, and then running Nix and the container within that (container-ception).
Building the binary outside of Nix with cross, and then somehow incorporating that into Nix, or building the image outside of Nix entirely.
Using an obscure overlay ^2 with its own binary cache.
nix run
works on macOS, however because it's built against our host system the binary fails inside of a container:We could potentially use
crossSystem
^1, however that loses access to the Nix binary cache, meaning we end up building the universe.Thus our options for building the container on macOS are: