nix-instantiate --eval: Apply auto-arguments if the result is a function

Fixes #254.
This commit is contained in:
Eelco Dolstra 2014-05-13 12:54:28 +02:00
parent a55e77ae10
commit 95501c4dee

View file

@ -52,14 +52,19 @@ void processExpr(EvalState & state, const Strings & attrPaths,
state.forceValue(v); state.forceValue(v);
PathSet context; PathSet context;
if (evalOnly) if (evalOnly) {
Value vRes;
if (autoArgs.empty())
vRes = v;
else
state.autoCallFunction(autoArgs, v, vRes);
if (xmlOutput) if (xmlOutput)
printValueAsXML(state, strict, location, v, std::cout, context); printValueAsXML(state, strict, location, vRes, std::cout, context);
else { else {
if (strict) state.strictForceValue(v); if (strict) state.strictForceValue(vRes);
std::cout << v << std::endl; std::cout << vRes << std::endl;
} }
else { } else {
DrvInfos drvs; DrvInfos drvs;
getDerivations(state, v, "", autoArgs, drvs, false); getDerivations(state, v, "", autoArgs, drvs, false);
foreach (DrvInfos::iterator, i, drvs) { foreach (DrvInfos::iterator, i, drvs) {