From 668fef2e4f1c7758e2a55e355b4826014d5b7ba9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Feb 2017 13:31:46 +0100 Subject: [PATCH] nix-shell: Overwrite environment variables Need to remember that std::map::insert() and emplace() don't overwrite existing entries... This fixes a regression relative to 1.11 that in particular triggers in nested nix-shells. Before: $ nativeBuildInputs=/foo nix-shell -p hello --run 'hello' build input /foo does not exist After: $ nativeBuildInputs=/foo nix-shell -p hello --run 'hello' Hello, world! --- src/nix-build/nix-build.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc index ee030c57b..f4484ba57 100755 --- a/src/nix-build/nix-build.cc +++ b/src/nix-build/nix-build.cc @@ -408,7 +408,7 @@ int main(int argc, char ** argv) env["NIX_STORE"] = store->storeDir; for (auto & var : drv.env) - env.emplace(var); + env[var.first] = var.second; restoreAffinity();