Skip to content

Commit

Permalink
Give Derivation::tryResolve an evalStore argument
Browse files Browse the repository at this point in the history
*N.B. Backport is modified not to change any call sites / behavior.*

This is needed for building CA deriations with a src store / dest store
split. In particular it is needed for Hydra.

NixOS/hydra#838 currently puts realizations,
and thus build outputs, in the local store, but it should not.

(cherry picked with modifications from commit 96dd757)
  • Loading branch information
Ericson2314 committed Dec 11, 2023
1 parent 43d55dd commit e6a0392
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libstore/derivations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1002,13 +1002,13 @@ static void rewriteDerivation(Store & store, BasicDerivation & drv, const String

}

std::optional<BasicDerivation> Derivation::tryResolve(Store & store) const
std::optional<BasicDerivation> Derivation::tryResolve(Store & store, Store * evalStore) const
{
std::map<std::pair<StorePath, std::string>, StorePath> inputDrvOutputs;

std::function<void(const StorePath &, const DerivedPathMap<StringSet>::ChildNode &)> accum;
accum = [&](auto & inputDrv, auto & node) {
for (auto & [outputName, outputPath] : store.queryPartialDerivationOutputMap(inputDrv)) {
for (auto & [outputName, outputPath] : store.queryPartialDerivationOutputMap(inputDrv, evalStore)) {
if (outputPath) {
inputDrvOutputs.insert_or_assign({inputDrv, outputName}, *outputPath);
if (auto p = get(node.childMap, outputName))
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/derivations.hh
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ struct Derivation : BasicDerivation
* 2. Input placeholders are replaced with realized input store
* paths.
*/
std::optional<BasicDerivation> tryResolve(Store & store) const;
std::optional<BasicDerivation> tryResolve(Store & store, Store * evalStore = nullptr) const;

/**
* Like the above, but instead of querying the Nix database for
Expand Down

0 comments on commit e6a0392

Please sign in to comment.