diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 40a2c88f32b8f..da1fa808a6f9d 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -8,6 +8,7 @@ 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; }; /* Elaborated systems contain functions, which means that they don't satisfy @@ -32,7 +33,7 @@ rec { **Warning**: This attribute is considered experimental and is subject to change. */ - flakeExposed = import ./flake-systems.nix { }; + flakeExposed = import ./flake-systems.nix { inherit lib; }; # Elaborate a `localSystem` or `crossSystem` so that it contains everything # necessary. diff --git a/lib/systems/flake-systems.nix b/lib/systems/flake-systems.nix index b1988c6a4fbb0..ab1481fb6bd03 100644 --- a/lib/systems/flake-systems.nix +++ b/lib/systems/flake-systems.nix @@ -4,26 +4,32 @@ # reasonably well are included. # # [RFC 46]: https://github.com/NixOS/rfcs/blob/master/rfcs/0046-platform-support-tiers.md -{ }: +{ lib }: -[ - # Tier 1 - "x86_64-linux" - # Tier 2 - "aarch64-linux" - "x86_64-darwin" - # Tier 3 - "armv6l-linux" - "armv7l-linux" - "i686-linux" - "mipsel-linux" +let + inherit (builtins) filter; + inherit (lib.lists) any; + inherit (lib.systems) elaborate; + inherit (lib.systems.supported) Tier1 Tier2 Tier3 Tier7; - # 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 -] + anyOf = includes: filter (s: any (include: s == include) includes); + getDoubles = map (s: (elaborate s).system); +in +getDoubles + ( Tier1 + ++ Tier2 + ) +++ anyOf [ "armv6l-linux" + "armv7l-linux" + "i686-linux" + "mipsel-linux" + ] + (getDoubles Tier3) +# Other platforms with sufficient support in stdenv which is not formally +# mandated by their platform tier. +++ anyOf [ "aarch64-darwin" + "armv5tel-linux" + "powerpc64-linux" + "riscv64-linux" + ] + (getDoubles Tier7) diff --git a/lib/systems/supported.nix b/lib/systems/supported.nix new file mode 100644 index 0000000000000..8ab907a6350bf --- /dev/null +++ b/lib/systems/supported.nix @@ -0,0 +1,79 @@ +# RFC #46 specified the authoritative source of platform support tiers would be +# the Nixpkgs manual. Brief discussion in +# [NixOS/rfcs#113](https://github.com/NixOS/rfcs/pull/113) indicated that code +# is often a better source of truth than documentation. This file is intented +# to be exactly that. + +{ lib }: + +let inherit (lib.systems.examples) + aarch64-android + aarch64-darwin + aarch64-embedded + aarch64-multiplatform + arm-embedded + armv7a-android-prebuilt + armv7l-hf-multiplatform + avr + gnu32 + gnu64 + i686-embedded + mingw32 + mingwW64 + mipsel-linux-gnu + musl64 + powernv + ppc-embedded + ppc64 + ppcle-embedded + raspberryPi + riscv64 + sheevaplug + wasm32 + x86_64-darwin + x86_64-embedded + x86_64-freebsd; +in { + tier1 = [ gnu64 ]; + + tier2 = [ aarch64-multiplatform x86_64-darwin ]; + + # Missing: + # armv8*-linux, gcc + glibc + # armv{6,7,8}*-linux, gcc + glibc, cross-compilation + # aarch64-linux, gcc + glibc, cross-compilation + tier3 = [ armv7l-hf-multiplatform gnu32 mipsel-linux-gnu musl64 raspberryPi ]; + + # Missing: + # x86_64-linux, gcc+musl — static + # x86_64-linux, clang+glibc + # x86_64-linux, clang+glibc — llvm linker + # x86_64-linux — Android + # armv8-linux — Android + tier4 = [ + aarch64-android + aarch64-embedded + arm-embedded + armv7a-android-prebuilt # Questionable due to the prebuiltness + avr + i686-embedded # i686-none? + mingw32 + mingwW64 + ppc-embedded + ppcle-embedded + x86_64-embedded # x86_64-none? + ]; + + # Missing: + # x86_64-linux, gcc+glibc — static + # x86_64-linux, gcc+glibc — llvm linker + tier5 = []; + + tier6 = [ powernv wasm32 ]; + + # Missing: + # i686-darwin + # i686-solaris + # x86_64-illumos + tier7 = [ aarch64-darwin sheevaplug ppc64 riscv64 x86_64-freebsd ]; +}