summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/functions/library/attrsets.xml44
-rw-r--r--lib/attrsets.nix3
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 47 insertions, 2 deletions
diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml
index 65d0b40e2e82..8fe2e324b3b2 100644
--- a/doc/functions/library/attrsets.xml
+++ b/doc/functions/library/attrsets.xml
@@ -1728,4 +1728,48 @@ recursiveUpdate
]]></programlisting>
</example>
</section>
+
+ <section xml:id="function-library-lib.attrsets.recurseIntoAttrs">
+ <title><function>lib.attrsets.recurseIntoAttrs</function></title>
+
+ <subtitle><literal>recurseIntoAttrs :: AttrSet -> AttrSet</literal>
+ </subtitle>
+
+ <xi:include href="./locations.xml" xpointer="lib.attrsets.recurseIntoAttrs" />
+
+ <para>
+ Make various Nix tools consider the contents of the resulting
+ attribute set when looking for what to build, find, etc.
+ </para>
+
+ <para>
+ This function only affects a single attribute set; it does not apply itself recursively for nested attribute sets.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term>
+ <varname>attrs</varname>
+ </term>
+ <listitem>
+ <para>
+ An attribute set to scan for derivations.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <example xml:id="function-library-lib.attrsets.recurseIntoAttrs-example">
+ <title>Making Nix look inside an attribute set</title>
+<programlisting><![CDATA[
+{ pkgs ? import <nixpkgs> {} }:
+{
+ myTools = pkgs.lib.recurseIntoAttrs {
+ inherit (pkgs) hello figlet;
+ };
+}
+]]></programlisting>
+ </example>
+ </section>
+
</section>
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 607a22393f8a..ae6e4e7c8518 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -475,6 +475,9 @@ rec {
/* Make various Nix tools consider the contents of the resulting
attribute set when looking for what to build, find, etc.
+
+ This function only affects a single attribute set; it does not
+ apply itself recursively for nested attribute sets.
*/
recurseIntoAttrs =
attrs: attrs // { recurseForDerivations = true; };
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 5fa010558ca5..5a1b52938d1c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -62,8 +62,6 @@ in
inherit (lib) lowPrio hiPrio appendToName makeOverridable;
- # Make various Nix tools consider the contents of the resulting
- # attribute set when looking for what to build, find, etc.
inherit (lib) recurseIntoAttrs;
# This is intended to be the reverse of recurseIntoAttrs, as it is