aboutsummaryrefslogtreecommitdiff
path: root/src/nix-instantiate/nix-instantiate.cc
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-02-04 10:37:10 -0500
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-07 18:03:38 +0100
commit84a8b5e9af2df4ed7f7860a6768daf83f72724ca (patch)
treeba91baa1c5d33dc32a510499a1c1edab8a12b89b /src/nix-instantiate/nix-instantiate.cc
parente4058fab64d82ddb7723142c7c595e80eeba0f3e (diff)
nix-instantiate --eval-only --read-write-mode: Don't depend on ordering
Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index 6a93acf39..e9f1284eb 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -97,23 +97,19 @@ void run(Strings args)
bool strict = false;
Strings attrPaths;
Bindings autoArgs;
+ bool wantsReadWrite = false;
for (Strings::iterator i = args.begin(); i != args.end(); ) {
string arg = *i++;
if (arg == "-")
readStdin = true;
- else if (arg == "--eval-only") {
- settings.readOnlyMode = true;
+ else if (arg == "--eval-only")
evalOnly = true;
- }
- else if (arg == "--read-write-mode") {
- settings.readOnlyMode = false;
- }
- else if (arg == "--parse-only") {
- settings.readOnlyMode = true;
+ else if (arg == "--read-write-mode")
+ wantsReadWrite = true;
+ else if (arg == "--parse-only")
parseOnly = evalOnly = true;
- }
else if (arg == "--find-file")
findFile = true;
else if (arg == "--attr" || arg == "-A") {
@@ -146,6 +142,9 @@ void run(Strings args)
files.push_back(arg);
}
+ if (evalOnly && !wantsReadWrite)
+ settings.readOnlyMode = true;
+
if (attrPaths.empty()) attrPaths.push_back("");
if (findFile) {