Merge pull request #68491 from roberth/fix-dontRecurseIntoAttrs
Fix dontRecurseIntoAttrs + add to lib + doc
This commit is contained in:
commit
e38a01db5d
@ -1667,4 +1667,48 @@ recursiveUpdate
|
|||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</section>
|
</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>
|
</section>
|
||||||
|
@ -473,6 +473,20 @@ rec {
|
|||||||
/* Pick the outputs of packages to place in buildInputs */
|
/* Pick the outputs of packages to place in buildInputs */
|
||||||
chooseDevOutputs = drvs: builtins.map getDev drvs;
|
chooseDevOutputs = drvs: builtins.map getDev drvs;
|
||||||
|
|
||||||
|
/* 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; };
|
||||||
|
|
||||||
|
/* Undo the effect of recurseIntoAttrs.
|
||||||
|
*/
|
||||||
|
dontRecurseIntoAttrs =
|
||||||
|
attrs: attrs // { recurseForDerivations = false; };
|
||||||
|
|
||||||
/*** deprecated stuff ***/
|
/*** deprecated stuff ***/
|
||||||
|
|
||||||
zipWithNames = zipAttrsWithNames;
|
zipWithNames = zipAttrsWithNames;
|
||||||
|
@ -73,7 +73,8 @@ let
|
|||||||
genAttrs isDerivation toDerivation optionalAttrs
|
genAttrs isDerivation toDerivation optionalAttrs
|
||||||
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
|
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
|
||||||
recursiveUpdate matchAttrs overrideExisting getOutput getBin
|
recursiveUpdate matchAttrs overrideExisting getOutput getBin
|
||||||
getLib getDev chooseDevOutputs zipWithNames zip;
|
getLib getDev chooseDevOutputs zipWithNames zip
|
||||||
|
recurseIntoAttrs dontRecurseIntoAttrs;
|
||||||
inherit (lists) singleton forEach foldr fold foldl foldl' imap0 imap1
|
inherit (lists) singleton forEach foldr fold foldl foldl' imap0 imap1
|
||||||
concatMap flatten remove findSingle findFirst any all count
|
concatMap flatten remove findSingle findFirst any all count
|
||||||
optional optionals toList range partition zipListsWith zipLists
|
optional optionals toList range partition zipListsWith zipLists
|
||||||
|
@ -62,9 +62,7 @@ in
|
|||||||
|
|
||||||
inherit (lib) lowPrio hiPrio appendToName makeOverridable;
|
inherit (lib) lowPrio hiPrio appendToName makeOverridable;
|
||||||
|
|
||||||
# Applying this to an attribute set will cause nix-env to look
|
inherit (lib) recurseIntoAttrs;
|
||||||
# inside the set for derivations.
|
|
||||||
recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; };
|
|
||||||
|
|
||||||
# This is intended to be the reverse of recurseIntoAttrs, as it is
|
# This is intended to be the reverse of recurseIntoAttrs, as it is
|
||||||
# defined now it exists mainly for documentation purposes, but you
|
# defined now it exists mainly for documentation purposes, but you
|
||||||
@ -72,7 +70,7 @@ in
|
|||||||
# the Attrs which is useful for testing massive changes. Ideally,
|
# the Attrs which is useful for testing massive changes. Ideally,
|
||||||
# every package subset not marked with recurseIntoAttrs should be
|
# every package subset not marked with recurseIntoAttrs should be
|
||||||
# marked with this.
|
# marked with this.
|
||||||
dontRecurseIntoAttrs = x: x;
|
inherit (lib) dontRecurseIntoAttrs;
|
||||||
|
|
||||||
stringsWithDeps = lib.stringsWithDeps;
|
stringsWithDeps = lib.stringsWithDeps;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user