diff options
Diffstat (limited to 'pkgs/lib/attrsets.nix')
-rw-r--r-- | pkgs/lib/attrsets.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/lib/attrsets.nix b/pkgs/lib/attrsets.nix index c19033682919c..f39b46db62138 100644 --- a/pkgs/lib/attrsets.nix +++ b/pkgs/lib/attrsets.nix @@ -270,4 +270,9 @@ rec { else eqStrict pat val ) [pattern attrs])); + # override only the attributes that are already present in the old set + # useful for deep-overriding + overrideExisting = old: new: + old // listToAttrs (map (attr: nameValuePair attr (attrByPath [attr] (getAttr attr old) new)) (attrNames old)); + } |