about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/nix-instantiate/main.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nix-instantiate/main.cc b/src/nix-instantiate/main.cc
index 3e9fad4ae4c3..3161d17f42ec 100644
--- a/src/nix-instantiate/main.cc
+++ b/src/nix-instantiate/main.cc
@@ -73,6 +73,23 @@ static void printDrvPaths(EvalState & state, Expr e)
         return;
     }
 
+    ATermList formals;
+    ATerm body, pos;
+    if (matchFunction(e, formals, body, pos)) {
+        for (ATermIterator i(formals); i; ++i) {
+            Expr name, def;
+            if (matchNoDefFormal(*i, name))
+                throw Error(format("expression evaluates to a function with no-default arguments (`%1%')")
+                    % aterm2String(name));
+            else if (!matchDefFormal(*i, name, def))
+                abort(); /* can't happen */
+        }
+
+        printDrvPaths(state, evalExpr(state,
+            makeCall(e, makeAttrs(ATermMap()))));
+        return;
+    }
+
     throw Error("expression does not evaluate to one or more derivations");
 }