diff --git a/src/nix/installables.cc b/src/nix/installables.cc index c97a0bdcf..415358970 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -296,15 +296,24 @@ struct InstallableStorePath : Installable Buildables toBuildables() override { - std::map outputs; - outputs.insert_or_assign("out", storePath); - Buildable b{ - .drvPath = storePath.isDerivation() ? storePath : std::optional(), - .outputs = std::move(outputs) - }; - Buildables bs; - bs.push_back(std::move(b)); - return bs; + if (storePath.isDerivation()) { + std::map outputs; + for (auto & [name, output] : store->readDerivation(storePath).outputs) + outputs.emplace(name, output.path); + return { + Buildable { + .drvPath = storePath, + .outputs = std::move(outputs) + } + }; + } else { + return { + Buildable { + .drvPath = {}, + .outputs = {{"out", storePath}} + } + }; + } } std::optional getStorePath() override