+44
-8
doc/cross-compilation.xml
+44
-8
doc/cross-compilation.xml
···-The exact scheme these fields is a bit ill-defined due to a long and convoluted evolution, but this is slowly being cleaned up.+The exact schema these fields follow is a bit ill-defined due to a long and convoluted evolution, but this is slowly being cleaned up.+You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent.···[Technically, only one need be specified and the others can be inferred, though the precision of inference may not be very good.]-See <literal>lib.systems.parse</literal> for the exact representation, along with some <literal>is*</literal>predicates.-These predicates are superior to the ones in <varname>stdenv</varname> as they aren't tied to the build platform (host, as previously discussed, would be a saner default).+Valid identifiers include "glibc" for GNU libc, "libsystem" for Darwin's Libsystem, and "uclibc" for µClibc.+These predicates are defined in <literal>lib.systems.inspect</literal>, and slapped on every platform.+They are superior to the ones in <varname>stdenv</varname> as they force the user to be explicit about which platform they are inspecting.···-See <literal>lib.systems.platforms</literal> for examples—there's hopefully one in there that will work verbatim for each platform one is working.+See <literal>lib.systems.platforms</literal> for examples—there's hopefully one in there that will work verbatim for each platform that is working.···More information needs to moved from the old wiki, especially <link xlink:href="https://nixos.org/wiki/CrossCompiling" />, for this section.-Many sources (manual, wiki, etc) probably mention passing <varname>system</varname>, <varname>platform</varname>, and, optionally, <varname>crossSystem</varname> to nixpkgs:-<varname>system</varname> and <varname>platform</varname> together determine the system on which packages are built, and <varname>crossSystem</varname> specifies the platform on which packages are ultimately intended to run, if it is different.-This still works, but with more recent changes, one can alternatively pass <varname>localSystem</varname>, containing <varname>system</varname> and <varname>platform</varname>, for symmetry.+Nixpkgs can be instantiated with <varname>localSystem</varname> alone, in which case there is no cross compiling and everything is built by and for that system,+or also with <varname>crossSystem</varname>, in which case packages run on the latter, but all building happens on the former.+Both parameters take the same schema as the 3 (build, host, and target) platforms defined in the previous section.+As mentioned above, <literal>lib.systems.examples</literal> has some platforms which are used as arguments for these parameters in practice.+You can use them programmatically, or on the command line like <command>nix-build <nixpkgs> --arg crossSystem '(import <nixpkgs/lib>).systems.examples.fooBarBaz'</command>.+While one is free to pass both parameters in full, there's a lot of logic to fill in missing fields.+As discussed in the previous section, only one of <varname>system</varname>, <varname>config</varname>, and <varname>parsed</varname> is needed to infer the other two.+Finally, <literal>localSystem.system</literal> is also <emphasis>impurely</emphasis> inferred based on the platform evaluation occurs.+This means it is often not necessary to pass <varname>localSystem</varname> at all, as in the command-line example in the previous paragraph.+Many sources (manual, wiki, etc) probably mention passing <varname>system</varname>, <varname>platform</varname>, along with the optional <varname>crossSystem</varname> to nixpkgs:+Passing those two instead of <varname>localSystem</varname> is still supported for compatibility, but is discouraged.+Indeed, much of the inference we do for these parameters is motivated by compatibility as much as convenience.One would think that <varname>localSystem</varname> and <varname>crossSystem</varname> overlap horribly with the three <varname>*Platforms</varname> (<varname>buildPlatform</varname>, <varname>hostPlatform,</varname> and <varname>targetPlatform</varname>; see <varname>stage.nix</varname> or the manual).
+1
lib/systems/default.nix
+1
lib/systems/default.nix
+130
lib/systems/examples.nix
+130
lib/systems/examples.nix
···
+8
-1
lib/systems/platforms.nix
+8
-1
lib/systems/platforms.nix
······
+10
-82
pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+10
-82
pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
···
+7
-82
pkgs/top-level/release-cross.nix
+7
-82
pkgs/top-level/release-cross.nix
···