From ec20f52e2ff61e9c36c2b894b62fc1b4bd04c71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 10 Aug 2020 11:06:06 +0100 Subject: [PATCH] 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. --- README.md | 16 +++++++++++++++- default.nix | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 75d7a73..b1991fb 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,13 @@ flakes. ## Usage +### `allSystems -> []` + +A list of all systems defined in nixpkgs. For a smaller list see `defaultSystems` + ### `defaultSystems -> []` -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: ```nix @@ -30,6 +34,16 @@ Eg: ```nix eachSystem ["x86_64-linux"] (system: { 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 -> ( -> attrs)` diff --git a/default.nix b/default.nix index d9eeb77..ceaad1d 100644 --- a/default.nix +++ b/default.nix @@ -14,6 +14,55 @@ let "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 {}; 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 eachDefaultSystem = eachSystem defaultSystems; @@ -71,6 +120,7 @@ let in { inherit + allSystems defaultSystems eachDefaultSystem eachSystem