about summary refs log tree commit diff
path: root/src/nix-instantiate
diff options
context:
space:
mode:
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");