aboutsummaryrefslogtreecommitdiff
path: root/src/nix-build/nix-build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-build/nix-build.cc')
-rwxr-xr-xsrc/nix-build/nix-build.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 085650e4f..357986980 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -245,7 +245,21 @@ static void _main(int argc, char * * argv)
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
state->repair = repair;
- Bindings & autoArgs = *myArgs.getAutoArgs(*state);
+ 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;
+ }();
if (packages) {
std::ostringstream joined;