Cross Compiling: Difference between revisions
imported>Jtojnar m do not use pkgconfig alias |
imported>Symphorien show how to use pkgsCross to get a shell, and remove mentions of pre-18.09 |
||
Line 4: | Line 4: | ||
Quick example to cross compile a package: [[Cheatsheet#Cross-compile_packages]]. | Quick example to cross compile a package: [[Cheatsheet#Cross-compile_packages]]. | ||
== Cross-Compiling in nixpkgs | == Cross-Compiling a package in nixpkgs == | ||
Cross-compilation is well supported in nixpkgs since 18.09. | |||
The basic idea is to use <code>pkgsCross.platform</code> instead of <code>pkgs</code>: | The basic idea is to use <code>pkgsCross.platform</code> instead of <code>pkgs</code>: | ||
<syntaxHighlight lang=bash> | <syntaxHighlight lang=bash> | ||
nix build - | nix-build '<nixpkgs>' -A pkgsCross.raspberryPi.openssl | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Line 34: | Line 34: | ||
}; | }; | ||
in | in | ||
... | mkShell {} | ||
</syntaxhighlight> | |||
Even shorter: | |||
<syntaxhighlight lang="nix"> | |||
let pkgs = import <nixpkgs> {}; in | |||
pkgs.pkgsCross.armv7l-hf-multiplatform.mkShell {} | |||
</syntaxhighlight> | </syntaxhighlight> | ||