From ee00af7a32def3d4d9b3e8d7f7f74e053432b9db Mon Sep 17 00:00:00 2001
From: Adam Joseph <adam@westernsemico.com>
Date: Sun, 22 Jan 2023 15:12:40 -0800
Subject: [PATCH 1/2] attrsets: clarify that mapAttrs maps over *leaf* attrs

---
 lib/attrsets.nix | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 1a7b90593b1d..23d4a762f2fb 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -480,8 +480,10 @@ rec {
 
 
   /* Like `mapAttrs`, except that it recursively applies itself to
-     attribute sets.  Also, the first argument of the argument
-     function is a *list* of the names of the containing attributes.
+     the *leaf* attributes of a potentially-nested attribute set:
+     the second argument of the function will never be an attrset.
+     Also, the first argument of the argument function is a *list*
+     of the names of the containing attributes.
 
      Example:
        mapAttrsRecursive (path: value: concatStringsSep "-" (path ++ [value]))

From a4e3e16258210b3300aaf247033f941d36b58c28 Mon Sep 17 00:00:00 2001
From: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
Date: Wed, 25 Jan 2023 02:52:54 +0000
Subject: [PATCH 2/2] Update lib/attrsets.nix

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
---
 lib/attrsets.nix | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 23d4a762f2fb..1a51225a80ed 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -483,7 +483,10 @@ rec {
      the *leaf* attributes of a potentially-nested attribute set:
      the second argument of the function will never be an attrset.
      Also, the first argument of the argument function is a *list*
-     of the names of the containing attributes.
+     of the attribute names that form the path to the leaf attribute.
+
+     For a function that gives you control over what counts as a leaf,
+     see `mapAttrsRecursiveCond`.
 
      Example:
        mapAttrsRecursive (path: value: concatStringsSep "-" (path ++ [value]))