about summary refs log tree commit diff
path: root/src/nix-instantiate
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-11-26T16·39+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-11-26T16·41+0100
commit408a7bfac1f4282ff6647696dfbc7988eed3a2ca (patch)
treeaf5c0c212e1a718240d855ef22930b7c1503d0cd /src/nix-instantiate
parent8d8d47abd2a66898aa5d8999fcd75b29991e529d (diff)
nix-instantiate: Fix read-only evaluation
Diffstat (limited to 'src/nix-instantiate')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index a5053c32376d..53cd711895ff 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -62,16 +62,9 @@ void processExpr(EvalState & state, const Strings & attrPaths,
                     Path drvPath = i->queryDrvPath(state);
 
                     /* What output do we want? */
-                    Path outPath = i->queryOutPath(state);
-                    Derivation drv = derivationFromPath(*store, drvPath);
-                    string outputName;
-                    foreach (DerivationOutputs::iterator, i, drv.outputs)
-                        if (i->second.path == outPath) {
-                            outputName = i->first;
-                            break;
-                        }
+                    string outputName = i->queryOutputName(state);
                     if (outputName == "")
-                        throw Error(format("derivation `%1%' does not have an output `%2%'") % drvPath % outPath);
+                        throw Error(format("derivation `%1%' lacks an `outputName' attribute ") % drvPath);
 
                     if (gcRoot == "")
                         printGCWarning();