about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/meta.nix7
-rw-r--r--pkgs/stdenv/generic/check-meta.nix2
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/meta.nix b/lib/meta.nix
index 62894aeb316b4..cdd3e1d596c03 100644
--- a/lib/meta.nix
+++ b/lib/meta.nix
@@ -78,10 +78,15 @@ rec {
 
        2. (modern) a pattern for the platform `parsed` field.
 
+       3. (functional) a predicate function returning a boolean.
+
      We can inject these into a pattern for the whole of a structured platform,
      and then match that.
   */
-  platformMatch = platform: elem: let
+  platformMatch = platform: elem:
+    if builtins.isFunction elem
+    then elem platform
+    else let
       pattern =
         if builtins.isString elem
         then { system = elem; }
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index 751e19d1681ae..94998bbfa0fee 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -271,7 +271,7 @@ let
     sourceProvenance = listOf lib.types.attrs;
     maintainers = listOf (attrsOf anything); # TODO use the maintainer type from lib/tests/maintainer-module.nix
     priority = int;
-    platforms = listOf (either str (attrsOf anything));   # see lib.meta.platformMatch
+    platforms = listOf (oneOf [ str (attrsOf anything) (functionTo bool) ]);   # see lib.meta.platformMatch
     hydraPlatforms = listOf str;
     broken = bool;
     unfree = bool;