From b7d097438b9b0f782a707f3295d320d824810864 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 24 Sep 2022 22:00:46 -0700 Subject: lib/meta.nix: platformMatch: allow predicate functions --- lib/meta.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/meta.nix') 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; } -- cgit 1.4.1