diff options
author | Robert Hensing <robert@roberthensing.nl> | 2019-09-11 12:57:38 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2019-09-11 13:12:06 +0200 |
commit | 8935bfb4ac3680e38a8811c12282e2026f7e82ae (patch) | |
tree | 12644c0cbf2d2868ce2595373e69294315f39915 /lib | |
parent | 0d71e6910131e5bf331c2c43967c87ab5ffccf0a (diff) | |
download | nixpkgs-8935bfb4ac3680e38a8811c12282e2026f7e82ae.tar nixpkgs-8935bfb4ac3680e38a8811c12282e2026f7e82ae.tar.gz nixpkgs-8935bfb4ac3680e38a8811c12282e2026f7e82ae.tar.bz2 nixpkgs-8935bfb4ac3680e38a8811c12282e2026f7e82ae.tar.lz nixpkgs-8935bfb4ac3680e38a8811c12282e2026f7e82ae.tar.xz nixpkgs-8935bfb4ac3680e38a8811c12282e2026f7e82ae.tar.zst nixpkgs-8935bfb4ac3680e38a8811c12282e2026f7e82ae.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/attrsets.nix | 6 | ||||
-rw-r--r-- | lib/default.nix | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix index d374d229f59..4b73735fd85 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.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; diff --git a/lib/default.nix b/lib/default.nix index 18d2dfae1e1..34c72a3512e 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -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 |