add allSystems (#7)

The flake design makes it unecessary hard to adopt new platforms
by hardcoding system. By having this list ready to use, I hope
people will write more portable flakes.
This commit is contained in:
Jörg Thalheim 2020-08-10 11:06:06 +01:00 committed by GitHub
parent 0c686c77c4
commit ec20f52e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 1 deletions

View File

@ -10,9 +10,13 @@ flakes.
## Usage ## Usage
### `allSystems -> [<system>]`
A list of all systems defined in nixpkgs. For a smaller list see `defaultSystems`
### `defaultSystems -> [<system>]` ### `defaultSystems -> [<system>]`
A list of all the systems supported by the nixpkgs project. The list of systems supported by nixpkgs and built by hydra.
Useful if you want add additional platforms: Useful if you want add additional platforms:
```nix ```nix
@ -30,6 +34,16 @@ Eg:
```nix ```nix
eachSystem ["x86_64-linux"] (system: { hello = 42; }) eachSystem ["x86_64-linux"] (system: { hello = 42; })
# => { hello.x86_64-linux.hello = 42; } # => { hello.x86_64-linux.hello = 42; }
eachSystem allSystems (system: { hello = 42; })
# => {
hello.aarch64-darwin = 42,
hello.aarch64-genode = 42,
hello.aarch64-linux = 42,
...
hello.x86_64-redox = 42,
hello.x86_64-solaris = 42,
hello.x86_64-windows = 42
}
``` ```
### `eachDefaultSystem -> (<system> -> attrs)` ### `eachDefaultSystem -> (<system> -> attrs)`

View File

@ -14,6 +14,55 @@ let
"x86_64-linux" "x86_64-linux"
]; ];
# List of all systems defined in nixpkgs
# Keep in sync with nixpkgs wit the following command:
# $ nix-instantiate --json --eval --expr "with import <nixpkgs> {}; lib.platforms.all" | jq
allSystems = [
"aarch64-linux"
"armv5tel-linux"
"armv6l-linux"
"armv7a-linux"
"armv7l-linux"
"mipsel-linux"
"i686-cygwin"
"i686-freebsd"
"i686-linux"
"i686-netbsd"
"i686-openbsd"
"x86_64-cygwin"
"x86_64-freebsd"
"x86_64-linux"
"x86_64-netbsd"
"x86_64-openbsd"
"x86_64-solaris"
"x86_64-darwin"
"i686-darwin"
"aarch64-darwin"
"armv7a-darwin"
"x86_64-windows"
"i686-windows"
"wasm64-wasi"
"wasm32-wasi"
"x86_64-redox"
"powerpc64le-linux"
"riscv32-linux"
"riscv64-linux"
"arm-none"
"armv6l-none"
"aarch64-none"
"avr-none"
"i686-none"
"x86_64-none"
"powerpc-none"
"msp430-none"
"riscv64-none"
"riscv32-none"
"vc4-none"
"js-ghcjs"
"aarch64-genode"
"x86_64-genode"
];
# eachSystem using defaultSystems # eachSystem using defaultSystems
eachDefaultSystem = eachSystem defaultSystems; eachDefaultSystem = eachSystem defaultSystems;
@ -71,6 +120,7 @@ let
in in
{ {
inherit inherit
allSystems
defaultSystems defaultSystems
eachDefaultSystem eachDefaultSystem
eachSystem eachSystem