NixOS on ARM: Difference between revisions

imported>Thanegill
mNo edit summary
imported>Thefloweringash
Replace external binfmt module with NixOS bintfmt module
Line 319: Line 319:
=== Compiling through QEMU ===
=== Compiling through QEMU ===


It is also possible to compile for aarch64 on your non-aarch64 local machine, or a remote builder, by registering QEMU as a binfmt wrapper for the aarch64 architecture. This <b>wrapper uses emulation</b> and will therefore be slower than comparable native machines. A [https://github.com/cleverca22/nixos-configs/blob/master/qemu.nix module] and and [https://github.com/cleverca22/nixos-configs/tree/master/overlays/qemu overlay] are provided by user '''@clever'''.
It is also possible to compile for aarch64 on your non-aarch64 local machine, or a remote builder, by registering QEMU as a binfmt wrapper for the aarch64 architecture. This <b>wrapper uses emulation</b> and will therefore be slower than comparable native machines.
 
To enable the binfmt wrapper on NixOS, add the following to `configuration.nix`
 
<syntaxHighlight lang=nix>
{
  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
}
</syntaxHighlight>


If you are building on non-NixOS machine with QEMU binfmt wrapper configured, you will want to configure nix daemon to let it know that it can build for aarch64. Add the following line to <code>/etc/nix/nix.conf</code>:
If you are building on non-NixOS machine with QEMU binfmt wrapper configured, you will want to configure nix daemon to let it know that it can build for aarch64. Add the following line to <code>/etc/nix/nix.conf</code>: