summary refs log tree commit diff
path: root/lib/systems/inspect.nix
diff options
context:
space:
mode:
authorDavid McFarland <corngood@gmail.com>2017-06-12 14:27:10 -0300
committerDavid McFarland <corngood@gmail.com>2017-06-26 09:33:41 -0300
commit4ac1901d54f4301df2f09b85e2f69769ee61dfc1 (patch)
tree652726201a2530ea3e697470291bb56a9612ceab /lib/systems/inspect.nix
parentbe75c5dffbc236e80d382237209434a05344f2a7 (diff)
downloadnixpkgs-4ac1901d54f4301df2f09b85e2f69769ee61dfc1.tar
nixpkgs-4ac1901d54f4301df2f09b85e2f69769ee61dfc1.tar.gz
nixpkgs-4ac1901d54f4301df2f09b85e2f69769ee61dfc1.tar.bz2
nixpkgs-4ac1901d54f4301df2f09b85e2f69769ee61dfc1.tar.lz
nixpkgs-4ac1901d54f4301df2f09b85e2f69769ee61dfc1.tar.xz
nixpkgs-4ac1901d54f4301df2f09b85e2f69769ee61dfc1.tar.zst
nixpkgs-4ac1901d54f4301df2f09b85e2f69769ee61dfc1.zip
stdenv: remove unix kernel family
System predicate patterns can now be specified as a list of OR'd
attribute sets.
Diffstat (limited to 'lib/systems/inspect.nix')
-rw-r--r--lib/systems/inspect.nix15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix
index 241c9365f2e..ec71592d119 100644
--- a/lib/systems/inspect.nix
+++ b/lib/systems/inspect.nix
@@ -1,8 +1,9 @@
 with import ./parse.nix;
 with import ../attrsets.nix;
+with import ../lists.nix;
 
 rec {
-  patterns = {
+  patterns = rec {
     "32bit"      = { cpu = { bits = 32; }; };
     "64bit"      = { cpu = { bits = 64; }; };
     i686         = { cpu = cpuTypes.i686; };
@@ -13,8 +14,8 @@ rec {
     BigEndian    = { cpu = { significantByte = significantBytes.bigEndian; }; };
     LittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; };
 
-    Unix         = { kernel = { families = { inherit (kernelFamilies) unix; }; }; };
     BSD          = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; };
+    Unix         = [ BSD Linux SunOS Hurd Cygwin ];
 
     Darwin       = { kernel = kernels.darwin; };
     Linux        = { kernel = kernels.linux; };
@@ -27,11 +28,15 @@ rec {
     Cygwin       = { kernel = kernels.windows; abi = abis.cygnus; };
     MinGW        = { kernel = kernels.windows; abi = abis.gnu; };
 
-    Arm32        = recursiveUpdate patterns.Arm patterns."32bit";
-    Arm64        = recursiveUpdate patterns.Arm patterns."64bit";
+    Arm32        = recursiveUpdate Arm patterns."32bit";
+    Arm64        = recursiveUpdate Arm patterns."64bit";
   };
 
+  matchAnyAttrs = patterns:
+    if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns
+    else matchAttrs patterns;
+
   predicates = mapAttrs'
-    (name: value: nameValuePair ("is" + name) (matchAttrs value))
+    (name: value: nameValuePair ("is" + name) (matchAnyAttrs value))
     patterns;
 }