about summary refs log tree commit diff
path: root/src/nix-instantiate/nix-instantiate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index 5abaa617d245..bea04180e513 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -155,14 +155,16 @@ int main(int argc, char * * argv)
             return true;
         });
 
+        if (evalOnly && !wantsReadWrite)
+            settings.readOnlyMode = true;
+
+        store = openStore();
+
         EvalState state(searchPath);
         state.repair = repair;
 
         Bindings & autoArgs(*evalAutoArgs(state, autoArgs_));
 
-        if (evalOnly && !wantsReadWrite)
-            settings.readOnlyMode = true;
-
         if (attrPaths.empty()) attrPaths.push_back("");
 
         if (findFile) {
@@ -174,8 +176,6 @@ int main(int argc, char * * argv)
             return;
         }
 
-        store = openStore();
-
         if (readStdin) {
             Expr * e = parseStdin(state);
             processExpr(state, attrPaths, parseOnly, strict, autoArgs,
@@ -183,10 +183,10 @@ int main(int argc, char * * argv)
         } else if (files.empty() && !fromArgs)
             files.push_back("./default.nix");
 
-        foreach (Strings::iterator, i, files) {
+        for (auto & i : files) {
             Expr * e = fromArgs
-                ? state.parseExprFromString(*i, absPath("."))
-                : state.parseExprFromFile(resolveExprPath(lookupFileArg(state, *i)));
+                ? state.parseExprFromString(i, absPath("."))
+                : state.parseExprFromFile(resolveExprPath(lookupFileArg(state, i)));
             processExpr(state, attrPaths, parseOnly, strict, autoArgs,
                 evalOnly, outputKind, xmlOutputSourceLocation, e);
         }