summaryrefslogtreecommitdiffstats
path: root/lib/systems/doubles.nix
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-02-09 16:09:47 -0500
committerJohn Ericson <Ericson2314@Yahoo.com>2017-04-17 17:13:01 -0400
commit8c99aab3ea4a9ddbd3918282da7861e674b4e7c4 (patch)
tree5c8a663c775e02ad7c7c714d89095f3cd500e0a0 /lib/systems/doubles.nix
parentfffcee35f9b2042d4edc5dccb3379972e03ffd84 (diff)
lib: Fix system parsing, and use for doubles lists
The old hard-coded lists are now used to test system parsing. In the process, make an `assertTrue` in release lib for eval tests; also use it in release-cross
Diffstat (limited to 'lib/systems/doubles.nix')
-rw-r--r--lib/systems/doubles.nix52
1 files changed, 36 insertions, 16 deletions
diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix
index 945147fe7cfb..2622ddf4be1f 100644
--- a/lib/systems/doubles.nix
+++ b/lib/systems/doubles.nix
@@ -1,24 +1,44 @@
let lists = import ../lists.nix; in
+let parse = import ./parse.nix; in
+let inherit (import ../attrsets.nix) matchAttrs; in
+
+let
+ all = [
+ "aarch64-linux"
+ "armv5tel-linux" "armv6l-linux" "armv7l-linux"
+
+ "mips64el-linux"
+
+ "i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd"
+
+ "x86_64-cygwin" "x86_64-darwin" "x86_64-freebsd" "x86_64-linux"
+ "x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris"
+ ];
+
+ allParsed = map parse.mkSystemFromString all;
+
+ filterDoubles = f: map parse.doubleFromSystem (lists.filter f allParsed);
+
+in rec {
+ inherit all;
-rec {
- all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
allBut = platforms: lists.filter (x: !(builtins.elem x platforms)) all;
none = [];
- arm = ["armv5tel-linux" "armv6l-linux" "armv7l-linux" ];
- i686 = ["i686-linux" "i686-freebsd" "i686-netbsd" "i686-cygwin"];
- mips = [ "mips64el-linux" ];
- x86_64 = ["x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin"];
-
- cygwin = ["i686-cygwin" "x86_64-cygwin"];
- darwin = ["x86_64-darwin"];
- freebsd = ["i686-freebsd" "x86_64-freebsd"];
- gnu = linux; /* ++ hurd ++ kfreebsd ++ ... */
- illumos = ["x86_64-solaris"];
- linux = ["i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mips64el-linux"];
- netbsd = ["i686-netbsd" "x86_64-netbsd"];
- openbsd = ["i686-openbsd" "x86_64-openbsd"];
- unix = linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
+ arm = filterDoubles (matchAttrs { cpu = { family = "arm"; bits = 32; }; });
+ i686 = filterDoubles parse.isi686;
+ mips = filterDoubles (matchAttrs { cpu = { family = "mips"; }; });
+ x86_64 = filterDoubles parse.isx86_64;
+
+ cygwin = filterDoubles (matchAttrs { kernel = parse.kernels.cygwin; });
+ darwin = filterDoubles parse.isDarwin;
+ freebsd = filterDoubles (matchAttrs { kernel = parse.kernels.freebsd; });
+ gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); # Should be better
+ illumos = filterDoubles (matchAttrs { kernel = parse.kernels.solaris; });
+ linux = filterDoubles parse.isLinux;
+ netbsd = filterDoubles (matchAttrs { kernel = parse.kernels.netbsd; });
+ openbsd = filterDoubles (matchAttrs { kernel = parse.kernels.openbsd; });
+ unix = filterDoubles parse.isUnix;
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux"];
}