1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 08:19:35 +01:00

Remove global fetcher cache

The cache is now part of fetchers::Settings.
This commit is contained in:
Eelco Dolstra 2025-05-14 14:17:57 +02:00
parent 7d89e46f65
commit efcb9e36a9
23 changed files with 93 additions and 54 deletions

View file

@ -4,9 +4,11 @@
#include "nix/store/filetransfer.hh"
#include "nix/store/store-open.hh"
#include "nix/cmd/legacy.hh"
#include "nix/cmd/common-eval-args.hh"
#include "nix/expr/eval-settings.hh" // for defexpr
#include "nix/util/users.hh"
#include "nix/fetchers/tarball.hh"
#include "nix/fetchers/fetch-settings.hh"
#include "self-exe.hh"
#include "man-pages.hh"
@ -114,7 +116,7 @@ static void update(const StringSet & channelNames)
// We want to download the url to a file to see if it's a tarball while also checking if we
// got redirected in the process, so that we can grab the various parts of a nix channel
// definition from a consistent location if the redirect changes mid-download.
auto result = fetchers::downloadFile(store, url, std::string(baseNameOf(url)));
auto result = fetchers::downloadFile(store, fetchSettings, url, std::string(baseNameOf(url)));
auto filename = store->toRealPath(result.storePath);
url = result.effectiveUrl;
@ -128,9 +130,9 @@ static void update(const StringSet & channelNames)
if (!unpacked) {
// Download the channel tarball.
try {
filename = store->toRealPath(fetchers::downloadFile(store, url + "/nixexprs.tar.xz", "nixexprs.tar.xz").storePath);
filename = store->toRealPath(fetchers::downloadFile(store, fetchSettings, url + "/nixexprs.tar.xz", "nixexprs.tar.xz").storePath);
} catch (FileTransferError & e) {
filename = store->toRealPath(fetchers::downloadFile(store, url + "/nixexprs.tar.bz2", "nixexprs.tar.bz2").storePath);
filename = store->toRealPath(fetchers::downloadFile(store, fetchSettings, url + "/nixexprs.tar.bz2", "nixexprs.tar.bz2").storePath);
}
}
// Regardless of where it came from, add the expression representing this channel to accumulated expression