aboutsummaryrefslogtreecommitdiff
path: root/src/nix-build
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-10-27 17:58:25 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-10-27 18:00:09 +0100
commit3913afdd69a5bd065d6096dd569397a836ac6857 (patch)
tree44743dd9b4edee873fdf77a16872aec231c6315c /src/nix-build
parent0e459d79a6b4f51088c2e3e5cb77e21a113322c9 (diff)
Simplification
Diffstat (limited to 'src/nix-build')
-rwxr-xr-xsrc/nix-build/nix-build.cc30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 357986980..1c5d71681 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -245,21 +245,17 @@ static void _main(int argc, char * * argv)
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
state->repair = repair;
- Bindings & autoArgs = *[&](){
- Bindings *userAutoArgs = myArgs.getAutoArgs(*state);
- if (runEnv) {
- Bindings * res = state->allocBindings(userAutoArgs->size() + 1);
- Value * tru = state->allocValue();
- mkBool(*tru, true);
- res->push_back(Attr(state->symbols.create("inNixShell"), tru));
- for (auto & i : *userAutoArgs) {
- res->push_back(i);
- }
- res->sort();
- return res;
- }
- else return userAutoArgs;
- }();
+ auto autoArgs = myArgs.getAutoArgs(*state);
+
+ if (runEnv) {
+ auto newArgs = state->allocBindings(autoArgs->size() + 1);
+ auto tru = state->allocValue();
+ mkBool(*tru, true);
+ newArgs->push_back(Attr(state->symbols.create("inNixShell"), tru));
+ for (auto & i : *autoArgs) newArgs->push_back(i);
+ newArgs->sort();
+ autoArgs = newArgs;
+ }
if (packages) {
std::ostringstream joined;
@@ -313,9 +309,9 @@ static void _main(int argc, char * * argv)
state->eval(e, vRoot);
for (auto & i : attrPaths) {
- Value & v(*findAlongAttrPath(*state, i, autoArgs, vRoot));
+ Value & v(*findAlongAttrPath(*state, i, *autoArgs, vRoot));
state->forceValue(v);
- getDerivations(*state, v, "", autoArgs, drvs, false);
+ getDerivations(*state, v, "", *autoArgs, drvs, false);
}
}