Simplification
This commit is contained in:
parent
0e459d79a6
commit
3913afdd69
|
@ -245,21 +245,17 @@ static void _main(int argc, char * * argv)
|
||||||
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
|
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
|
||||||
state->repair = repair;
|
state->repair = repair;
|
||||||
|
|
||||||
Bindings & autoArgs = *[&](){
|
auto autoArgs = myArgs.getAutoArgs(*state);
|
||||||
Bindings *userAutoArgs = myArgs.getAutoArgs(*state);
|
|
||||||
if (runEnv) {
|
if (runEnv) {
|
||||||
Bindings * res = state->allocBindings(userAutoArgs->size() + 1);
|
auto newArgs = state->allocBindings(autoArgs->size() + 1);
|
||||||
Value * tru = state->allocValue();
|
auto tru = state->allocValue();
|
||||||
mkBool(*tru, true);
|
mkBool(*tru, true);
|
||||||
res->push_back(Attr(state->symbols.create("inNixShell"), tru));
|
newArgs->push_back(Attr(state->symbols.create("inNixShell"), tru));
|
||||||
for (auto & i : *userAutoArgs) {
|
for (auto & i : *autoArgs) newArgs->push_back(i);
|
||||||
res->push_back(i);
|
newArgs->sort();
|
||||||
|
autoArgs = newArgs;
|
||||||
}
|
}
|
||||||
res->sort();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
else return userAutoArgs;
|
|
||||||
}();
|
|
||||||
|
|
||||||
if (packages) {
|
if (packages) {
|
||||||
std::ostringstream joined;
|
std::ostringstream joined;
|
||||||
|
@ -313,9 +309,9 @@ static void _main(int argc, char * * argv)
|
||||||
state->eval(e, vRoot);
|
state->eval(e, vRoot);
|
||||||
|
|
||||||
for (auto & i : attrPaths) {
|
for (auto & i : attrPaths) {
|
||||||
Value & v(*findAlongAttrPath(*state, i, autoArgs, vRoot));
|
Value & v(*findAlongAttrPath(*state, i, *autoArgs, vRoot));
|
||||||
state->forceValue(v);
|
state->forceValue(v);
|
||||||
getDerivations(*state, v, "", autoArgs, drvs, false);
|
getDerivations(*state, v, "", *autoArgs, drvs, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue