I build on x86_64-linux using boot.binfmt.emulatedSystems to emulate aarch64-linux. As long as packages are available in the cache, the emulation doesn’t slow things down. If I need to build something big myself, I switch to cross-compilation.
Thank you @Majiir . I set boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; and I got some errors that some packages are only for “x86_64-linux” and “i686-linux” which is a good sign that it is working.
I remove those packages, run build again and I got
error: Package ‘uboot-rpi_3_defconfig-2023.01’ in /nix/store/fwpalmvh6cnphvvd6n362a5cq22ixniz-source/pkgs/misc/uboot/default.nix:124 is not available on the requested hostPlatform:
hostPlatform.config = "x86_64-unknown-linux-gnu"
package.meta.platforms = [
"aarch64-linux"
]
package.meta.badPlatforms = [ ]
, refusing to evaluate.
You can check that your config is OK by building it first on an actual ARM instance - for example AWS m6g.large will cost you less than $1 even if you keep it running for a whole day. And prebuild NixOS instances are available in AWS for ARM CPUs.