about summary refs log tree commit diff
path: root/src/nix-env/nix-env.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-26T14·50+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-26T14·52+0200
commit39d72640c2459dc2fa689bfe8b756ee193f7b98a (patch)
tree2d889185bf06c0446d9b3774054f1264fbf443ff /src/nix-env/nix-env.cc
parenta8edf185a9e1677088c8c30acc9d281c8350bca7 (diff)
Ensure that -I flags get included in nixPath
Also fixes #261.
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r--src/nix-env/nix-env.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 3db84ff5c7b5..2d38f2aea729 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -58,6 +58,7 @@ struct Globals
     bool removeAll;
     string forceName;
     bool prebuiltOnly;
+    Globals(const Strings & searchPath) : state(searchPath) { }
 };
 
 
@@ -1351,7 +1352,17 @@ void run(Strings args)
     Strings opFlags, opArgs, remaining;
     Operation op = 0;
 
-    Globals globals;
+    /* FIXME: hack. */
+    Strings searchPath;
+    Strings args2;
+    for (Strings::iterator i = args.begin(); i != args.end(); ) {
+        string arg = *i++;
+        if (!parseSearchPathArg(arg, i, args.end(), searchPath))
+            args2.push_back(arg);
+    }
+    args = args2;
+
+    Globals globals(searchPath);
 
     globals.instSource.type = srcUnknown;
     globals.instSource.nixExprPath = getDefNixExprPath();
@@ -1372,8 +1383,6 @@ void run(Strings args)
         else if (parseOptionArg(arg, i, args.end(),
                      globals.state, globals.instSource.autoArgs))
             ;
-        else if (parseSearchPathArg(arg, i, args.end(), globals.state))
-            ;
         else if (arg == "--force-name") // undocumented flag for nix-install-package
             globals.forceName = needArg(i, args, arg);
         else if (arg == "--uninstall" || arg == "-e")