about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-03-23T16·43+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-03-23T16·43+0000
commitb69e4693287d481ee75f948227a2c508391ef055 (patch)
tree2185d27ec28245020a393c879f2c6e5fac71318f /src
parent49ce8b57ddc459faef8192be04f69b9e777afc75 (diff)
* In `nix-env', look for derivations inside attribute sets that have
  the `recurseForDerivations' attribute set to `true'.

Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.hh1
-rw-r--r--src/libexpr/get-drvs.cc16
2 files changed, 16 insertions, 1 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index cbdcb274e062..8070f4884c79 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -55,6 +55,7 @@ Expr evalFile(EvalState & state, const Path & path);
 /* Specific results. */
 string evalString(EvalState & state, Expr e);
 Path evalPath(EvalState & state, Expr e);
+bool evalBool(EvalState & state, Expr e);
 ATermList evalList(EvalState & state, Expr e);
 ATerm coerceToString(Expr e);
 
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index ff38ff794812..78edbd392d19 100644
--- a/src/libexpr/get-drvs.cc
+++ b/src/libexpr/get-drvs.cc
@@ -171,7 +171,21 @@ static void getDerivations(EvalState & state, Expr e,
             for (ATermIterator i(drvMap.keys()); i; ++i) {
                 startNest(nest, lvlDebug,
                     format("evaluating attribute `%1%'") % aterm2String(*i));
-                getDerivation(state, drvMap.get(*i), drvs, doneExprs);
+                if (getDerivation(state, drvMap.get(*i), drvs, doneExprs)) {
+                    /* If the value of this attribute is itself an
+                       attribute self, should we recurse into it?
+                       => Only if it has a `recurseForDerivations = true'
+                       attribute. */
+                    ATermList es;
+                    Expr e = evalExpr(state, drvMap.get(*i));
+                    if (matchAttrs(e, es)) {
+                        ATermMap attrs;
+                        queryAllAttrs(e, attrs, false);
+                        if (attrs.get("recurseForDerivations") &&
+                            evalBool(state, attrs.get("recurseForDerivations")))
+                            getDerivations(state, e, drvs, doneExprs, attrPathRest);
+                    }
+                }
             }
         } else {
             Expr e2 = drvMap.get(attr);