query
On this page

mergeAttrsNoOverride

lib.misc.mergeAttrsNoOverride

Docs pulled from | This Revision | 10 minutes ago
Deprecated


! deprecated, use mergeAttrByFunc instead


Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

mergeAttrsNoOverride =
    {
      mergeLists ? [
        "buildInputs"
        "propagatedBuildInputs"
      ],
      overrideSnd ? [ "buildPhase" ],
    }:
    attrs1: attrs2:
    foldr (
      n: set:
      setAttr set n (
        if set ? ${n} then # merge
          if
            elem n mergeLists # attribute contains list, merge them by concatenating
          then
            attrs2.${n} ++ attrs1.${n}
          else if elem n overrideSnd then
            attrs1.${n}
          else
            throw "error mergeAttrsNoOverride, attribute ${n} given in both attributes - no merge func defined"
        else
          attrs2.${n} # add attribute not existing in attr1
      )
    ) attrs1 (attrNames attrs2);