what is interesting is that the documentation says:
--fast
Equivalent to --no-build-nix. This option is useful if you call nixos-rebuild frequently (e.g. if you’re hacking on a NixOS module).
where:
--no-build-nix
Normally, nixos-rebuild first builds the nixUnstable attribute in Nixpkgs, and uses the resulting instance of the Nix package manager to build the new system configuration. This is necessary if the NixOS modules use features not provided by the currently installed version of Nix. This option disables building a new Nix.
However running it with --no-build-nix instead of --fast fails as before:
I was getting this error while doing the same thing on a Github runner (x86_64-linux building for aarch64-linux):
bin/mktemp: cannot execute binary file: Exec format error
…and of course changing boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; in a Github runner is impractical, but it turns out that with QEMU installed and extra-platforms set, it works for me:
Just wanted to let you know that I was also getting the following error when running nixos-rebuild from Apple silicon aarch64-darwin with virtual x86_64-linux capable builder:
/nix/.../coreutils-9.5/bin/mktemp: cannot execute binary file: Exec format error
But when I also added --fast flag for the nixos-rebuild command this started to work for me