about summary refs log tree commit diff
path: root/src/libmain/common-args.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain/common-args.cc')
-rw-r--r--src/libmain/common-args.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libmain/common-args.cc b/src/libmain/common-args.cc
index 9e1d7cee60e6..0486932b20e7 100644
--- a/src/libmain/common-args.cc
+++ b/src/libmain/common-args.cc
@@ -1,5 +1,6 @@
 #include "common-args.hh"
 #include "globals.hh"
+#include "download.hh"
 
 namespace nix {
 
@@ -44,6 +45,16 @@ MixCommonArgs::MixCommonArgs(const string & programName)
             settings.set("max-jobs", s);
         });
 
+    mkFlag()
+        .longName("no-net")
+        .description("disable substituters and consider all previously downloaded files up-to-date")
+        .handler([]() {
+            settings.useSubstitutes = false;
+            settings.tarballTtl = std::numeric_limits<unsigned int>::max();
+            downloadSettings.tries = 0;
+            downloadSettings.connectTimeout = 1;
+        });
+
     std::string cat = "config";
     globalConfig.convertToArgs(*this, cat);