aboutsummaryrefslogtreecommitdiff
path: root/src/nix-instantiate/nix-instantiate.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-13 12:54:28 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-13 12:56:48 +0200
commit95501c4deea1d945022df18475340232bc6980be (patch)
treeee3c97105ce097a008403a969076d76a134f6f62 /src/nix-instantiate/nix-instantiate.cc
parenta55e77ae10a76336728be6fbb0f0d7957422b56a (diff)
nix-instantiate --eval: Apply auto-arguments if the result is a function
Fixes #254.
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index afd16b3a5..7cdabcb92 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -52,14 +52,19 @@ void processExpr(EvalState & state, const Strings & attrPaths,
state.forceValue(v);
PathSet context;
- if (evalOnly)
+ if (evalOnly) {
+ Value vRes;
+ if (autoArgs.empty())
+ vRes = v;
+ else
+ state.autoCallFunction(autoArgs, v, vRes);
if (xmlOutput)
- printValueAsXML(state, strict, location, v, std::cout, context);
+ printValueAsXML(state, strict, location, vRes, std::cout, context);
else {
- if (strict) state.strictForceValue(v);
- std::cout << v << std::endl;
+ if (strict) state.strictForceValue(vRes);
+ std::cout << vRes << std::endl;
}
- else {
+ } else {
DrvInfos drvs;
getDerivations(state, v, "", autoArgs, drvs, false);
foreach (DrvInfos::iterator, i, drvs) {