Cross Compiling: Difference between revisions
Improve examples |
→Tips and tricks: NixOS config example |
||
Line 159: | Line 159: | ||
} | } | ||
) { } | ) { } | ||
</syntaxhighlight> | |||
=== Using cross-compiled packages in the host NixOS config === | |||
First, configure your builder as a trusted [[Binary Cache|binary cache]]. | |||
Then copy the cross-compiled package to the host using <code>nix copy</code>. | |||
Finally modify your <code>configuration.nix</code> as follows: | |||
<syntaxhighlight lang="nix"> | |||
let pkgsCross = import <nixpkgs> { | |||
localSystem = "x86_64-linux"; # <-- put your builder's platform here and below | |||
hostSystem = "x86_64-linux"; | |||
crossSystem = "aarch64-linux"; # <-- put your host's platform here | |||
}; | |||
in | |||
{ | |||
environment.systemPackages = [ | |||
pkgsCross.hello # <-- put your cross-compiled package here | |||
]; | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||