forked from mirrors/nixpkgs
lib/meta.nix: allow patterns over entire platform, not just .parsed
This commit is contained in:
parent
778419b9e6
commit
1690aa6858
|
@ -76,7 +76,9 @@ rec {
|
||||||
|
|
||||||
1. (legacy) a system string.
|
1. (legacy) a system string.
|
||||||
|
|
||||||
2. (modern) a pattern for the platform `parsed` field.
|
2. (modern) a pattern for the entire platform structure.
|
||||||
|
|
||||||
|
3. (modern) a pattern for the platform `parsed` field.
|
||||||
|
|
||||||
We can inject these into a pattern for the whole of a structured platform,
|
We can inject these into a pattern for the whole of a structured platform,
|
||||||
and then match that.
|
and then match that.
|
||||||
|
@ -85,6 +87,8 @@ rec {
|
||||||
pattern =
|
pattern =
|
||||||
if builtins.isString elem
|
if builtins.isString elem
|
||||||
then { system = elem; }
|
then { system = elem; }
|
||||||
|
else if elem?parsed
|
||||||
|
then elem
|
||||||
else { parsed = elem; };
|
else { parsed = elem; };
|
||||||
in lib.matchAttrs pattern platform;
|
in lib.matchAttrs pattern platform;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue