1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00

Derivations can output "text-hashed" data

In particular, this means that derivations can output derivations. But
that ramification isn't (yet!) useful as we would want, since there is
no way to have a dependent derivation that is itself a dependent
derivation.
This commit is contained in:
John Ericson 2020-10-12 23:51:23 +00:00
parent a0f369aa3f
commit a4e5de1b9d
15 changed files with 322 additions and 137 deletions

View file

@ -111,9 +111,21 @@ void Store::computeFSClosure(const StorePath & startPath,
std::optional<ContentAddress> getDerivationCA(const BasicDerivation & drv)
{
auto out = drv.outputs.find("out");
if (out != drv.outputs.end()) {
if (auto v = std::get_if<DerivationOutputCAFixed>(&out->second.output))
return v->hash;
if (out == drv.outputs.end())
return std::nullopt;
if (auto dof = std::get_if<DerivationOutputCAFixed>(&out->second.output)) {
return std::visit(overloaded {
[&](TextInfo ti) -> std::optional<ContentAddress> {
if (!ti.references.empty())
return std::nullopt;
return static_cast<TextHash>(ti);
},
[&](FixedOutputInfo fi) -> std::optional<ContentAddress> {
if (fi.references != PathReferences<StorePath> {})
return std::nullopt;
return static_cast<FixedOutputHash>(fi);
},
}, dof->ca);
}
return std::nullopt;
}