kernel-headers: infer ARCH from config triple
This makes us less reliant on the systems/examples.nix. You should be
able to cross compile with just your triple:
$ nix build --arg crossSystem '{ config = "armv6l-unknown-linux-gnueabi"; }' stdenv
commitd8934feba1399d220550b81dceeb6da35149cf02
authorMatthew Bauer <mjbauer95@gmail.com>
dateFri 19 Apr 2019, 14:51 (8 years ago)
parent97a3c7f
lib/systems/default.nix+7
@@ -72,6 +72,13 @@ rec {
7272 release = null;
7373 };
7474
75+ kernelArch =
76+ if final.isAarch32 then "arm"
77+ else if final.isAarch64 then "arm64"
78+ else if final.isx86_32 then "x86"
79+ else if final.isx86_64 then "ia64"
80+ else final.parsed.cpu.name;
81+
7582 qemuArch =
7683 if final.isArm then "arm"
7784 else if final.isx86_64 then "x86_64"
pkgs/os-specific/linux/kernel-headers/default.nix+1−1
@@ -12,7 +12,7 @@ let
1212 inherit sha256;
1313 };
1414
15− ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or (throw "missing kernelArch");
15+ ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch;
1616
1717 # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
1818 # We do this so we have a build->build, not build->host, C compiler.