about summary refs log tree commit diff
path: root/src/nix-instantiate
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-instantiate
parenta8edf185a9e1677088c8c30acc9d281c8350bca7 (diff)
Ensure that -I flags get included in nixPath
Also fixes #261.
Diffstat (limited to 'src/nix-instantiate')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index 7cdabcb92402..cdd74523ca72 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -91,7 +91,17 @@ void processExpr(EvalState & state, const Strings & attrPaths,
 
 void run(Strings args)
 {
-    EvalState state;
+    /* 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;
+
+    EvalState state(searchPath);
     Strings files;
     bool readStdin = false;
     bool fromArgs = false;
@@ -127,8 +137,6 @@ void run(Strings args)
         }
         else if (parseOptionArg(arg, i, args.end(), state, autoArgs))
             ;
-        else if (parseSearchPathArg(arg, i, args.end(), state))
-            ;
         else if (arg == "--add-root") {
             if (i == args.end())
                 throw UsageError("`--add-root' requires an argument");