mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 16:23:02 +00:00
Tarball fetcher: Fix fetchToStore() and eval caching
This commit is contained in:
parent
a713476790
commit
9d95c228ee
@ -260,6 +260,7 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(ref<Store> sto
|
||||
|
||||
auto [accessor, final] = scheme->getAccessor(store, *this);
|
||||
|
||||
assert(!accessor->fingerprint);
|
||||
accessor->fingerprint = scheme->getFingerprint(store, final);
|
||||
|
||||
return {accessor, std::move(final)};
|
||||
|
@ -365,6 +365,16 @@ struct TarballInputScheme : CurlInputScheme
|
||||
|
||||
return {result.accessor, input};
|
||||
}
|
||||
|
||||
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
|
||||
{
|
||||
if (auto narHash = input.getNarHash())
|
||||
return narHash->to_string(HashFormat::SRI, true);
|
||||
else if (auto rev = input.getRev())
|
||||
return rev->gitRev();
|
||||
else
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
static auto rTarballInputScheme = OnStartup([] { registerInputScheme(std::make_unique<TarballInputScheme>()); });
|
||||
|
Loading…
Reference in New Issue
Block a user