diff options
author | Robert Hensing <robert@roberthensing.nl> | 2019-09-11 14:51:28 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2019-09-11 14:55:23 +0200 |
commit | a96f37db10fb2892d0420a7ef51c5b157d9e58dd (patch) | |
tree | 4217f8ffd0ea88de2146da62fc5b2392abf15232 | |
parent | fc64cf65abfd6f42910a639f7ffb996788a95797 (diff) | |
download | nixpkgs-a96f37db10fb2892d0420a7ef51c5b157d9e58dd.tar nixpkgs-a96f37db10fb2892d0420a7ef51c5b157d9e58dd.tar.gz nixpkgs-a96f37db10fb2892d0420a7ef51c5b157d9e58dd.tar.bz2 nixpkgs-a96f37db10fb2892d0420a7ef51c5b157d9e58dd.tar.lz nixpkgs-a96f37db10fb2892d0420a7ef51c5b157d9e58dd.tar.xz nixpkgs-a96f37db10fb2892d0420a7ef51c5b157d9e58dd.tar.zst nixpkgs-a96f37db10fb2892d0420a7ef51c5b157d9e58dd.zip |
Document attrsets.recurseIntoAttrs
-rw-r--r-- | doc/functions/library/attrsets.xml | 44 | ||||
-rw-r--r-- | lib/attrsets.nix | 3 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
3 files changed, 47 insertions, 2 deletions
diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml index 65d0b40e2e8..8fe2e324b3b 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 607a22393f8..ae6e4e7c851 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 5fa010558ca..5a1b52938d1 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 |