mirror of
https://github.com/NixOS/nix
synced 2025-06-29 02:11:15 +02:00
Add '--no-net' convenience flag
This flag
* Disables substituters.
* Sets the tarball-ttl to infinity (ensuring e.g. that the flake
registry and any downloaded flakes are considered current).
* Disables retrying downloads and sets the connection timeout to the
minimum. (So it doesn't completely disable downloads at the moment.)
(cherry picked from commit 8ea842260b
)
This commit is contained in:
parent
78fa47a7f0
commit
7b9c68766d
5 changed files with 35 additions and 20 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue