Cheatsheet: Difference between revisions

Rhendric (talk | contribs)
Frontear (talk | contribs)
change an unnecessarily complicated example and link to main cross compiling page, which I am going to overhaul.
Line 246: Line 246:
=== Cross-compile packages ===
=== Cross-compile packages ===


The following command will cross compile the tinc package for the aarch64 CPU architecture from a different architecture (e.g. x86_64).
The following command will cross compile the <code>tinc</code> package for the aarch64 CPU architecture from the current system architecture (e.g. x86_64 if you are running a x86_64 system).


<syntaxHighlight lang="console">
<syntaxhighlight lang="console">
$ nix-build '<nixpkgs>' --arg crossSystem '(import <nixpkgs> {}).lib.systems.examples.aarch64-multiplatform' -A tinc
$ nix-build '<nixpkgs>' -A pkgsCross.aarch64-multiplatform.tinc
</syntaxHighlight>
</syntaxhighlight>


You can add your own specifications, or look at existing ones, in nixpkgs/lib/systems/examples.nix.
There are alternative ways to specify and build cross compiled packages, see [[Cross Compiling]].


=== Customizing Packages ===
=== Customizing Packages ===