aboutsummaryrefslogtreecommitdiff
path: root/src/nix/app.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/app.cc')
-rw-r--r--src/nix/app.cc32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/nix/app.cc b/src/nix/app.cc
index fb149042c..c9637dcf5 100644
--- a/src/nix/app.cc
+++ b/src/nix/app.cc
@@ -80,17 +80,27 @@ UnresolvedApp Installable::toApp(EvalState & state)
auto [program, context] = cursor->getAttr("program")->getStringWithContext();
std::vector<DerivedPath> context2;
- for (auto & [path, name] : context) {
- context2.push_back(name != "" || path.isDerivation()
- ? (DerivedPath) DerivedPath::Built {
- .drvPath = path,
- .outputs = name != ""
- ? StringSet { name }
- : StringSet { },
- }
- : (DerivedPath) DerivedPath::Opaque {
- .path = path,
- });
+ for (auto & c : context) {
+ context2.emplace_back(std::visit(overloaded {
+ [&](const NixStringContextElem::DrvDeep & d) -> DerivedPath {
+ /* We want all outputs of the drv */
+ return DerivedPath::Built {
+ .drvPath = d.drvPath,
+ .outputs = {},
+ };
+ },
+ [&](const NixStringContextElem::Built & b) -> DerivedPath {
+ return DerivedPath::Built {
+ .drvPath = b.drvPath,
+ .outputs = { b.output },
+ };
+ },
+ [&](const NixStringContextElem::Opaque & o) -> DerivedPath {
+ return DerivedPath::Opaque {
+ .path = o.path,
+ };
+ },
+ }, c.raw()));
}
return UnresolvedApp{App {