query
On this page

mapDefinitionValue

lib.modules.mapDefinitionValue

Docs pulled from | This Revision | 15 minutes ago


Nixpkgs manual

Applies a function to the value inside a definition, preserving all surrounding properties (mkForce, mkOrder, mkIf, etc.).

Noogle detected

Implementation

The following is the current implementation of this function.

mapDefinitionValue =
    f: def:
    if def ? _type then
      if def._type == "merge" then
        def // { contents = map (mapDefinitionValue f) def.contents; }
      else if def._type == "if" then
        def // { content = mapDefinitionValue f def.content; }
      else if def._type == "override" then
        def // { content = mapDefinitionValue f def.content; }
      else if def._type == "order" then
        def // { content = mapDefinitionValue f def.content; }
      else if def._type == "definition" then
        def // { value = mapDefinitionValue f def.value; }
      else
        f def
    else
      f def;