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.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();