about summary refs log tree commit diff
path: root/src/nix-instantiate/nix-instantiate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index 86bb1841b9a0..a71998de24d3 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -75,8 +75,23 @@ void processExpr(EvalState & state, const Strings & attrPaths,
         std::cout << format("%1%\n") % canonicaliseExpr(e);
     else {
         Value v;
-        state.strictEval(e, v);
-        std::cout << v << std::endl;
+        if (strict) state.strictEval(e, v); else state.eval(e, v);
+        if (evalOnly)
+            std::cout << v << std::endl;
+        else {
+            DrvInfos drvs;
+            getDerivations(state, v, "", autoArgs, drvs);
+            foreach (DrvInfos::iterator, i, drvs) {
+                Path drvPath = i->queryDrvPath(state);
+                if (gcRoot == "")
+                    printGCWarning();
+                else
+                    drvPath = addPermRoot(drvPath,
+                        makeRootName(gcRoot, rootNr),
+                        indirectRoot);
+                std::cout << format("%1%\n") % drvPath;
+            }
+        }
     }
     
 #if 0