aboutsummaryrefslogtreecommitdiff
path: root/src/nix-build
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-11-04 22:29:31 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-11-04 22:29:31 +0100
commitb81d9d26f50784ab1884e2cc6bc470d5cba91bc9 (patch)
treebf1a03fff022f94271df102d045d6b33e677c2c6 /src/nix-build
parente34b317bbf778efb4e9bee5d34fb2ceb7776de3f (diff)
parentf5a46ef0b1d76d32238f76ab8253f0d2d9fc72c9 (diff)
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/nix-build')
-rwxr-xr-xsrc/nix-build/nix-build.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 50909608a..45db2f699 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -245,7 +245,17 @@ static void _main(int argc, char * * argv)
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
state->repair = repair;
- Bindings & autoArgs = *myArgs.getAutoArgs(*state);
+ 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;
@@ -299,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);
}
}