diff --git a/src/libstore/include/nix/store/remote-fs-accessor.hh b/src/libstore/include/nix/store/remote-fs-accessor.hh index 62f4dd726..479a73932 100644 --- a/src/libstore/include/nix/store/remote-fs-accessor.hh +++ b/src/libstore/include/nix/store/remote-fs-accessor.hh @@ -31,8 +31,6 @@ class RemoteFSAccessor : public SourceAccessor friend struct BinaryCacheStore; - std::filesystem::path makeCacheFile(const Hash & narHash, const std::string & ext); - public: /** diff --git a/src/libstore/remote-fs-accessor.cc b/src/libstore/remote-fs-accessor.cc index 1af82d279..88a5083dd 100644 --- a/src/libstore/remote-fs-accessor.cc +++ b/src/libstore/remote-fs-accessor.cc @@ -18,15 +18,6 @@ RemoteFSAccessor::RemoteFSAccessor( createDirs(*cacheDir); } -std::filesystem::path RemoteFSAccessor::makeCacheFile(const Hash & narHash, const std::string & ext) -{ - assert(cacheDir); - auto res = *cacheDir / narHash.to_string(HashFormat::Nix32, false); - res += "."; - res += ext; - return res; -} - std::pair, CanonPath> RemoteFSAccessor::fetch(const CanonPath & path) { auto [storePath, restPath] = store->toStorePath(store->storeDir + path.abs()); @@ -57,8 +48,15 @@ std::shared_ptr RemoteFSAccessor::accessObject(const StorePath & }; if (cacheDir) { - auto cacheFile = makeCacheFile(info->narHash, "nar"); - auto listingFile = makeCacheFile(info->narHash, "ls"); + auto makeCacheFile = [&](const std::string & ext) { + auto res = *cacheDir / info->narHash.to_string(HashFormat::Nix32, false); + res += "."; + res += ext; + return res; + }; + + auto cacheFile = makeCacheFile("nar"); + auto listingFile = makeCacheFile("ls"); if (nix::pathExists(cacheFile)) { try {