diff options
author | Adam Joseph <adam@westernsemico.com> | 2022-09-24 22:00:46 -0700 |
---|---|---|
committer | Adam Joseph <adam@westernsemico.com> | 2023-01-22 00:27:19 -0800 |
commit | b7d097438b9b0f782a707f3295d320d824810864 (patch) | |
tree | 9be29acaa5d3eff2f75d7a088b14e5907b568365 /lib/meta.nix | |
parent | d3eee3182cc2b93de2a109796fdfe79dad3349a6 (diff) |
lib/meta.nix: platformMatch: allow predicate functions
Diffstat (limited to 'lib/meta.nix')
-rw-r--r-- | lib/meta.nix | 7 |
1 files changed, 6 insertions, 1 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; } |