aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-28 17:34:48 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-03-24 14:26:23 +0100
commitc85097da7c1ef06e2f1912c922110ff358de3aa2 (patch)
tree8cd45d44bb07eefd43fbd4506a48480fac397403
parent6b824c78f1f6c2de95b594a440118e259d28def0 (diff)
Fix --refresh with --no-net
https://hydra.nixos.org/build/110879699 (cherry picked from commit 5bbe793abf18414878a069399d1759673d693fb6)
-rw-r--r--src/nix/main.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 5cb1ad25e..3b5f5516f 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -55,6 +55,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
{
bool printBuildLogs = false;
bool useNet = true;
+ bool refresh = false;
NixArgs() : MultiCommand(*RegisterCommand::commands), MixCommonArgs("nix")
{
@@ -96,7 +97,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
mkFlag()
.longName("refresh")
.description("consider all previously downloaded files out-of-date")
- .handler([&]() { settings.tarballTtl = 0; });
+ .handler([&]() { refresh = true; });
}
void printFlags(std::ostream & out) override
@@ -181,6 +182,9 @@ void mainWrapped(int argc, char * * argv)
downloadSettings.connectTimeout = 1;
}
+ if (args.refresh)
+ settings.tarballTtl = 0;
+
args.command->prepare();
args.command->run();
}