Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/systems/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
48 changes: 27 additions & 21 deletions lib/systems/flake-systems.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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)
79 changes: 79 additions & 0 deletions lib/systems/supported.nix
Original file line number Diff line number Diff line change
@@ -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 ];
}