about summary refs log tree commit diff
path: root/src/nix-build/nix-build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-24T12·31+0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-24T12·31+0100
commit668fef2e4f1c7758e2a55e355b4826014d5b7ba9 (patch)
tree84cec1fffc099e5db5c9afbd078c4bd068b7e99c /src/nix-build/nix-build.cc
parentf023f64f40809afa8a8e3a5e7081209cbcfd2e7e (diff)
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!
Diffstat (limited to 'src/nix-build/nix-build.cc')
-rwxr-xr-xsrc/nix-build/nix-build.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index ee030c57b6b3..f4484ba572d3 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();