diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-12-06 19:57:55 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-02-08 13:48:30 +0000 |
commit | bf3aadfdd39aa197e18bade671fab6726349ffa4 (patch) | |
tree | 698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/lib/systems | |
parent | f4afc5a01d9539ce09e47494e679c51f80723d07 (diff) | |
parent | 99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff) | |
download | nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2 nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip |
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/lib/systems')
-rw-r--r-- | nixpkgs/lib/systems/default.nix | 18 | ||||
-rw-r--r-- | nixpkgs/lib/systems/doubles.nix | 5 | ||||
-rw-r--r-- | nixpkgs/lib/systems/examples.nix | 45 | ||||
-rw-r--r-- | nixpkgs/lib/systems/flake-systems.nix | 29 | ||||
-rw-r--r-- | nixpkgs/lib/systems/inspect.nix | 6 | ||||
-rw-r--r-- | nixpkgs/lib/systems/parse.nix | 20 | ||||
-rw-r--r-- | nixpkgs/lib/systems/platforms.nix | 17 | ||||
-rw-r--r-- | nixpkgs/lib/systems/supported.nix | 26 |
8 files changed, 86 insertions, 80 deletions
diff --git a/nixpkgs/lib/systems/default.nix b/nixpkgs/lib/systems/default.nix index 7ddd5b8a5812..2990afde3e9a 100644 --- a/nixpkgs/lib/systems/default.nix +++ b/nixpkgs/lib/systems/default.nix @@ -8,7 +8,13 @@ rec { platforms = import ./platforms.nix { inherit lib; }; examples = import ./examples.nix { inherit lib; }; architectures = import ./architectures.nix { inherit lib; }; - supported = import ./supported.nix { inherit lib; }; + + /* List of all Nix system doubles the nixpkgs flake will expose the package set + for. All systems listed here must be supported by nixpkgs as `localSystem`. + + **Warning**: This attribute is considered experimental and is subject to change. + */ + flakeExposed = import ./flake-systems.nix { }; # Elaborate a `localSystem` or `crossSystem` so that it contains everything # necessary. @@ -25,8 +31,12 @@ rec { # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. system = parse.doubleFromSystem final.parsed; config = parse.tripleFromSystem final.parsed; - # Determine whether we are compatible with the provided CPU - isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu; + # Determine whether we can execute binaries built for the provided platform. + canExecute = platform: + final.isAndroid == platform.isAndroid && + parse.isCompatible final.parsed.cpu platform.parsed.cpu + && final.parsed.kernel == platform.parsed.kernel; + isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details"; # Derived meta-data libc = /**/ if final.isDarwin then "libSystem" @@ -159,7 +169,7 @@ rec { wine = (pkgs.winePackagesFor wine-name).minimal; in if final.parsed.kernel.name == pkgs.stdenv.hostPlatform.parsed.kernel.name && - pkgs.stdenv.hostPlatform.isCompatible final + pkgs.stdenv.hostPlatform.canExecute final then "${pkgs.runtimeShell} -c '\"$@\"' --" else if final.isWindows then "${wine}/bin/${wine-name}" diff --git a/nixpkgs/lib/systems/doubles.nix b/nixpkgs/lib/systems/doubles.nix index 27cdaf6a7233..90a6eb9f35c9 100644 --- a/nixpkgs/lib/systems/doubles.nix +++ b/nixpkgs/lib/systems/doubles.nix @@ -41,7 +41,7 @@ let # none "aarch64_be-none" "aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none" "msp430-none" "or1k-none" "m68k-none" "powerpc-none" "powerpcle-none" - "riscv32-none" "riscv64-none" "s390-none" "s390x-none" "vc4-none" + "riscv32-none" "riscv64-none" "rx-none" "s390-none" "s390x-none" "vc4-none" "x86_64-none" # OpenBSD @@ -74,6 +74,9 @@ in { mips = filterDoubles predicates.isMips; mmix = filterDoubles predicates.isMmix; riscv = filterDoubles predicates.isRiscV; + riscv32 = filterDoubles predicates.isRiscV32; + riscv64 = filterDoubles predicates.isRiscV64; + rx = filterDoubles predicates.isRx; vc4 = filterDoubles predicates.isVc4; or1k = filterDoubles predicates.isOr1k; m68k = filterDoubles predicates.isM68k; diff --git a/nixpkgs/lib/systems/examples.nix b/nixpkgs/lib/systems/examples.nix index 997a7a8c273a..65dc9c07e346 100644 --- a/nixpkgs/lib/systems/examples.nix +++ b/nixpkgs/lib/systems/examples.nix @@ -57,30 +57,28 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; rustc.config = "armv7-linux-androideabi"; - sdkVer = "29"; - ndkVer = "21"; + sdkVer = "28"; + ndkVer = "24"; useAndroidPrebuilt = true; } // platforms.armv7a-android; aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; rustc.config = "aarch64-linux-android"; - sdkVer = "29"; - ndkVer = "21"; + sdkVer = "28"; + ndkVer = "24"; useAndroidPrebuilt = true; }; aarch64-android = { config = "aarch64-unknown-linux-android"; sdkVer = "30"; - ndkVer = "21"; + ndkVer = "24"; libc = "bionic"; useAndroidPrebuilt = false; useLLVM = true; }; - scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1; - pogoplug4 = { config = "armv5tel-unknown-linux-gnueabi"; } // platforms.pogoplug4; @@ -93,25 +91,23 @@ rec { config = "mipsel-unknown-linux-gnu"; } // platforms.fuloong2f_n32; - # MIPS ABI table transcribed from here: https://wiki.debian.org/Multiarch/Tuples - # can execute on 32bit chip - mips-linux-gnu = { config = "mips-linux-gnu"; } // platforms.gcc_mips32r2_o32; - mipsel-linux-gnu = { config = "mipsel-linux-gnu"; } // platforms.gcc_mips32r2_o32; - mipsisa32r6-linux-gnu = { config = "mipsisa32r6-linux-gnu"; } // platforms.gcc_mips32r6_o32; - mipsisa32r6el-linux-gnu = { config = "mipsisa32r6el-linux-gnu"; } // platforms.gcc_mips32r6_o32; + mips-linux-gnu = { config = "mips-unknown-linux-gnu"; } // platforms.gcc_mips32r2_o32; + mipsel-linux-gnu = { config = "mipsel-unknown-linux-gnu"; } // platforms.gcc_mips32r2_o32; + mipsisa32r6-linux-gnu = { config = "mipsisa32r6-unknown-linux-gnu"; } // platforms.gcc_mips32r6_o32; + mipsisa32r6el-linux-gnu = { config = "mipsisa32r6el-unknown-linux-gnu"; } // platforms.gcc_mips32r6_o32; # require 64bit chip (for more registers, 64-bit floating point, 64-bit "long long") but use 32bit pointers - mips64-linux-gnuabin32 = { config = "mips64-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32; - mips64el-linux-gnuabin32 = { config = "mips64el-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32; - mipsisa64r6-linux-gnuabin32 = { config = "mipsisa64r6-linux-gnuabin32"; } // platforms.gcc_mips64r6_n32; - mipsisa64r6el-linux-gnuabin32 = { config = "mipsisa64r6el-linux-gnuabin32"; } // platforms.gcc_mips64r6_n32; + mips64-linux-gnuabin32 = { config = "mips64-unknown-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32; + mips64el-linux-gnuabin32 = { config = "mips64el-unknown-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32; + mipsisa64r6-linux-gnuabin32 = { config = "mipsisa64r6-unknown-linux-gnuabin32"; } // platforms.gcc_mips64r6_n32; + mipsisa64r6el-linux-gnuabin32 = { config = "mipsisa64r6el-unknown-linux-gnuabin32"; } // platforms.gcc_mips64r6_n32; # 64bit pointers - mips64-linux-gnuabi64 = { config = "mips64-linux-gnuabi64"; } // platforms.gcc_mips64r2_64; - mips64el-linux-gnuabi64 = { config = "mips64el-linux-gnuabi64"; } // platforms.gcc_mips64r2_64; - mipsisa64r6-linux-gnuabi64 = { config = "mipsisa64r6-linux-gnuabi64"; } // platforms.gcc_mips64r6_64; - mipsisa64r6el-linux-gnuabi64 = { config = "mipsisa64r6el-linux-gnuabi64"; } // platforms.gcc_mips64r6_64; + mips64-linux-gnuabi64 = { config = "mips64-unknown-linux-gnuabi64"; } // platforms.gcc_mips64r2_64; + mips64el-linux-gnuabi64 = { config = "mips64el-unknown-linux-gnuabi64"; } // platforms.gcc_mips64r2_64; + mipsisa64r6-linux-gnuabi64 = { config = "mipsisa64r6-unknown-linux-gnuabi64"; } // platforms.gcc_mips64r6_64; + mipsisa64r6el-linux-gnuabi64 = { config = "mipsisa64r6el-unknown-linux-gnuabi64"; } // platforms.gcc_mips64r6_64; muslpi = raspberryPi // { config = "armv6l-unknown-linux-musleabihf"; @@ -145,6 +141,11 @@ rec { libc = "newlib"; }; + rx-embedded = { + config = "rx-none-elf"; + libc = "newlib"; + }; + msp430 = { config = "msp430-elf"; libc = "newlib"; @@ -303,8 +304,6 @@ rec { # BSDs - amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd; - x86_64-netbsd = { config = "x86_64-unknown-netbsd"; libc = "nblibc"; diff --git a/nixpkgs/lib/systems/flake-systems.nix b/nixpkgs/lib/systems/flake-systems.nix new file mode 100644 index 000000000000..74124c32e836 --- /dev/null +++ b/nixpkgs/lib/systems/flake-systems.nix @@ -0,0 +1,29 @@ +# See [RFC 46] for mandated platform support and ../../pkgs/stdenv for +# implemented platform support. This list is mainly descriptive, i.e. all +# system doubles for platforms where nixpkgs can do native compiliation +# reasonably well are included. +# +# [RFC 46]: https://github.com/NixOS/rfcs/blob/master/rfcs/0046-platform-support-tiers.md +{ }: + +[ + # Tier 1 + "x86_64-linux" + # Tier 2 + "aarch64-linux" + "x86_64-darwin" + # Tier 3 + "armv6l-linux" + "armv7l-linux" + "i686-linux" + "mipsel-linux" + + # Other platforms with sufficient support in stdenv which is not formally + # mandated by their platform tier. + "aarch64-darwin" + "armv5tel-linux" + "powerpc64le-linux" + "riscv64-linux" + + # "x86_64-freebsd" is excluded because it is mostly broken +] diff --git a/nixpkgs/lib/systems/inspect.nix b/nixpkgs/lib/systems/inspect.nix index 89cac575c67d..dbffca0300b5 100644 --- a/nixpkgs/lib/systems/inspect.nix +++ b/nixpkgs/lib/systems/inspect.nix @@ -11,11 +11,12 @@ rec { isi686 = { cpu = cpuTypes.i686; }; isx86_32 = { cpu = { family = "x86"; bits = 32; }; }; isx86_64 = { cpu = { family = "x86"; bits = 64; }; }; - isPowerPC = { cpu = cpuTypes.powerpc; }; isPower = { cpu = { family = "power"; }; }; + isPower64 = { cpu = { family = "power"; bits = 64; }; }; isx86 = { cpu = { family = "x86"; }; }; isAarch32 = { cpu = { family = "arm"; bits = 32; }; }; isAarch64 = { cpu = { family = "arm"; bits = 64; }; }; + isAarch = { cpu = { family = "arm"; }; }; isMips = { cpu = { family = "mips"; }; }; isMips32 = { cpu = { family = "mips"; bits = 32; }; }; isMips64 = { cpu = { family = "mips"; bits = 64; }; }; @@ -23,6 +24,9 @@ rec { isMips64n64 = { cpu = { family = "mips"; bits = 64; }; abi = { abi = "64"; }; }; isMmix = { cpu = { family = "mmix"; }; }; isRiscV = { cpu = { family = "riscv"; }; }; + isRiscV32 = { cpu = { family = "riscv"; bits = 32; }; }; + isRiscV64 = { cpu = { family = "riscv"; bits = 64; }; }; + isRx = { cpu = { family = "rx"; }; }; isSparc = { cpu = { family = "sparc"; }; }; isWasm = { cpu = { family = "wasm"; }; }; isMsp430 = { cpu = { family = "msp430"; }; }; diff --git a/nixpkgs/lib/systems/parse.nix b/nixpkgs/lib/systems/parse.nix index 3ceddbb599b9..9d2571c993a9 100644 --- a/nixpkgs/lib/systems/parse.nix +++ b/nixpkgs/lib/systems/parse.nix @@ -116,6 +116,7 @@ rec { alpha = { bits = 64; significantByte = littleEndian; family = "alpha"; }; + rx = { bits = 32; significantByte = littleEndian; family = "rx"; }; msp430 = { bits = 16; significantByte = littleEndian; family = "msp430"; }; avr = { bits = 8; family = "avr"; }; @@ -147,8 +148,10 @@ rec { # Every CPU is compatible with itself. # - (transitivity) # If A is compatible with B and B is compatible with C then A is compatible with C. - # - (compatible under multiple endianness) - # CPUs with multiple modes of endianness are pairwise compatible. + # + # Note: Since 22.11 the archs of a mode switching CPU are no longer considered + # pairwise compatible. Mode switching implies that binaries built for A + # and B respectively can't be executed at the same time. isCompatible = a: b: with cpuTypes; lib.any lib.id [ # x86 (b == i386 && isCompatible a i486) @@ -190,22 +193,13 @@ rec { (b == aarch64 && a == armv8a) (b == armv8a && isCompatible a aarch64) - (b == aarch64 && a == aarch64_be) - (b == aarch64_be && isCompatible a aarch64) - # PowerPC (b == powerpc && isCompatible a powerpc64) - (b == powerpcle && isCompatible a powerpc) - (b == powerpc && a == powerpcle) - (b == powerpc64le && isCompatible a powerpc64) - (b == powerpc64 && a == powerpc64le) + (b == powerpcle && isCompatible a powerpc64le) # MIPS (b == mips && isCompatible a mips64) - (b == mips && a == mipsel) - (b == mipsel && isCompatible a mips) - (b == mips64 && a == mips64el) - (b == mips64el && isCompatible a mips64) + (b == mipsel && isCompatible a mips64el) # RISCV (b == riscv32 && isCompatible a riscv64) diff --git a/nixpkgs/lib/systems/platforms.nix b/nixpkgs/lib/systems/platforms.nix index 04d55416242e..41c25484cea0 100644 --- a/nixpkgs/lib/systems/platforms.nix +++ b/nixpkgs/lib/systems/platforms.nix @@ -3,7 +3,7 @@ # targetPlatform, etc) containing at least the minimal set of attrs # required (see types.parsedPlatform in lib/systems/parse.nix). This # file takes an already-valid platform and further elaborates it with -# optional fields such as linux-kernel, gcc, etc. +# optional fields; currently these are: linux-kernel, gcc, and rustc. { lib }: rec { @@ -242,13 +242,6 @@ rec { }; }; - scaleway-c1 = armv7l-hf-multiplatform // { - gcc = { - cpu = "cortex-a9"; - fpu = "vfpv3"; - }; - }; - utilite = { linux-kernel = { name = "utilite"; @@ -490,8 +483,8 @@ rec { }; # can execute on 32bit chip - gcc_mips32r2_o32 = { gcc = { arch = "mips32r2"; abi = "o32"; }; }; - gcc_mips32r6_o32 = { gcc = { arch = "mips32r6"; abi = "o32"; }; }; + gcc_mips32r2_o32 = { gcc = { arch = "mips32r2"; abi = "32"; }; }; + gcc_mips32r6_o32 = { gcc = { arch = "mips32r6"; abi = "32"; }; }; gcc_mips64r2_n32 = { gcc = { arch = "mips64r2"; abi = "n32"; }; }; gcc_mips64r6_n32 = { gcc = { arch = "mips64r6"; abi = "n32"; }; }; gcc_mips64r2_64 = { gcc = { arch = "mips64r2"; abi = "64"; }; }; @@ -500,7 +493,7 @@ rec { # based on: # https://www.mail-archive.com/qemu-discuss@nongnu.org/msg05179.html # https://gmplib.org/~tege/qemu.html#mips64-debian - mips64el-qemu-linux-gnuabi64 = (import ./examples).mips64el-linux-gnuabi64 // { + mips64el-qemu-linux-gnuabi64 = { linux-kernel = { name = "mips64el"; baseConfig = "64r2el_defconfig"; @@ -568,5 +561,5 @@ rec { else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv - else pc; + else { }; } diff --git a/nixpkgs/lib/systems/supported.nix b/nixpkgs/lib/systems/supported.nix deleted file mode 100644 index a1c038a5c8bc..000000000000 --- a/nixpkgs/lib/systems/supported.nix +++ /dev/null @@ -1,26 +0,0 @@ -# Supported systems according to RFC0046's definition. -# -# https://github.com/NixOS/rfcs/blob/master/rfcs/0046-platform-support-tiers.md -{ lib }: -rec { - # List of systems that are built by Hydra. - hydra = tier1 ++ tier2 ++ tier3 ++ [ - "aarch64-darwin" - ]; - - tier1 = [ - "x86_64-linux" - ]; - - tier2 = [ - "aarch64-linux" - "x86_64-darwin" - ]; - - tier3 = [ - "armv6l-linux" - "armv7l-linux" - "i686-linux" - "mipsel-linux" - ]; -} |