lib: Add recurseIntoAttrs

This makes the function available without having to evaluate the
Nixpkgs fix-point, making it available in a more natural way for
code that deals with multiple Nixpkgs invocations.

Its definition is coupled to Nix rather than Nixpkgs, so it will
feel right at home in lib.
wip/yesman
Robert Hensing 5 years ago
parent 0d71e69101
commit 8935bfb4ac
  1. 6
      lib/attrsets.nix
  2. 3
      lib/default.nix
  3. 6
      pkgs/top-level/all-packages.nix

@ -473,6 +473,12 @@ rec {
/* Pick the outputs of packages to place in buildInputs */
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.
*/
recurseIntoAttrs =
attrs: attrs // { recurseForDerivations = true; };
/*** deprecated stuff ***/
zipWithNames = zipAttrsWithNames;

@ -70,7 +70,8 @@ let
genAttrs isDerivation toDerivation optionalAttrs
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
recursiveUpdate matchAttrs overrideExisting getOutput getBin
getLib getDev chooseDevOutputs zipWithNames zip;
getLib getDev chooseDevOutputs zipWithNames zip
recurseIntoAttrs;
inherit (lists) singleton forEach foldr fold foldl foldl' imap0 imap1
concatMap flatten remove findSingle findFirst any all count
optional optionals toList range partition zipListsWith zipLists

@ -62,9 +62,9 @@ in
inherit (lib) lowPrio hiPrio appendToName makeOverridable;
# Applying this to an attribute set will cause nix-env to look
# inside the set for derivations.
recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; };
# 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
# defined now it exists mainly for documentation purposes, but you

Loading…
Cancel
Save