Merge pull request #4724 from NixOS/nix-shell-missing-outputs

Make `nix shell` fallback to static outputs when needed
This commit is contained in:
Eelco Dolstra 2021-04-22 10:25:55 +02:00 committed by GitHub
commit dd83b29b90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -736,9 +736,18 @@ std::set<RealisedPath> toRealisedPaths(
output.first); output.first);
auto outputId = DrvOutput{outputHashes.at(output.first), output.first}; auto outputId = DrvOutput{outputHashes.at(output.first), output.first};
auto realisation = store->queryRealisation(outputId); auto realisation = store->queryRealisation(outputId);
if (!realisation) if (!realisation) {
throw Error("cannot operate on an output of unbuilt content-addresed derivation '%s'", outputId.to_string()); // TODO: remove this check once #4725 is fixed
res.insert(RealisedPath{*realisation}); // as well have the guaranty that if
// `output.second` exists, then the realisation
// will be there too
if (output.second)
res.insert(*output.second);
else
throw Error("cannot operate on an output of unbuilt content-addresed derivation '%s'", outputId.to_string());
} else {
res.insert(RealisedPath{*realisation});
}
} }
else { else {
// If ca-derivations isn't enabled, behave as if // If ca-derivations isn't enabled, behave as if