query
On this page

matchAttrs

lib.attrsets.matchAttrs

Docs pulled from | This Revision | 24 minutes ago


Nixpkgs manual

Recurse into every attribute set of the first argument and check that:

  • Each attribute path also exists in the second argument.
  • If the attribute's value is not a nested attribute set, it must have the same value in the right argument.

Inputs

pattern

Attribute set structure to match

attrs

Attribute set to check

Type

matchAttrs :: AttrSet -> AttrSet -> Bool

Examples

lib.attrsets.matchAttrs usage example

matchAttrs { cpu = {}; } { cpu = { bits = 64; }; }
=> true

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

pattern:
    assert isAttrs pattern;
    recurse pattern