summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-07-01 14:25:26 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-07-01 14:25:26 +0000
commit638ce339a52da893693f667c8b330a2adefdd92a (patch)
tree97aa1c4288ba50f19e058f5d965942079fd1599a
parent292d6468ec73212a2ada3bd5f7f3f6e897f9086e (diff)
downloadguix-638ce339a52da893693f667c8b330a2adefdd92a.tar.gz
* Nix-instantiate now accepts sets of derivations (just like nix-env).
-rw-r--r--src/nix-instantiate/main.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nix-instantiate/main.cc b/src/nix-instantiate/main.cc
index 5ef6bd7d1b..0a533d4c77 100644
--- a/src/nix-instantiate/main.cc
+++ b/src/nix-instantiate/main.cc
@@ -30,6 +30,8 @@ static void printNixExpr(EvalState & state, Expr e)
     ATMatcher m;
     ATermList es;
 
+    /* !!! duplication w.r.t. parseDerivations in nix-env */
+
     if (atMatch(m, e) >> "Attrs" >> es) {
         Expr a = queryAttr(e, "type");
         if (a && evalString(state, a) == "derivation") {
@@ -38,6 +40,13 @@ static void printNixExpr(EvalState & state, Expr e)
                 cout << format("%1%\n") % evalPath(state, a);
                 return;
             }
+            throw Error("bad derivation");
+        } else {
+            ATermMap drvMap;
+            queryAllAttrs(e, drvMap);
+            for (ATermIterator i(drvMap.keys()); i; ++i)
+                printNixExpr(state, evalExpr(state, drvMap.get(*i)));
+            return;
         }
     }