diff options
Diffstat (limited to 'src/nix/app.cc')
-rw-r--r-- | src/nix/app.cc | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/nix/app.cc b/src/nix/app.cc index bfd75e278..34fac9935 100644 --- a/src/nix/app.cc +++ b/src/nix/app.cc @@ -1,11 +1,13 @@ #include "installables.hh" #include "installable-derived-path.hh" +#include "installable-value.hh" #include "store-api.hh" #include "eval-inline.hh" #include "eval-cache.hh" #include "names.hh" #include "command.hh" #include "derivations.hh" +#include "downstream-placeholder.hh" namespace nix { @@ -18,13 +20,22 @@ StringPairs resolveRewrites( const std::vector<BuiltPathWithResult> & dependencies) { StringPairs res; - for (auto & dep : dependencies) - if (auto drvDep = std::get_if<BuiltPathBuilt>(&dep.path)) - for (auto & [ outputName, outputPath ] : drvDep->outputs) - res.emplace( - downstreamPlaceholder(store, drvDep->drvPath, outputName), - store.printStorePath(outputPath) - ); + if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) { + for (auto & dep : dependencies) { + if (auto drvDep = std::get_if<BuiltPathBuilt>(&dep.path)) { + for (auto & [ outputName, outputPath ] : drvDep->outputs) { + res.emplace( + DownstreamPlaceholder::fromSingleDerivedPathBuilt( + SingleDerivedPath::Built { + .drvPath = make_ref<SingleDerivedPath>(drvDep->drvPath->discardOutputPath()), + .output = outputName, + }).render(), + store.printStorePath(outputPath) + ); + } + } + } + } return res; } @@ -40,7 +51,7 @@ std::string resolveString( return rewriteStrings(toResolve, rewrites); } -UnresolvedApp Installable::toApp(EvalState & state) +UnresolvedApp InstallableValue::toApp(EvalState & state) { auto cursor = getCursor(state); auto attrPath = cursor->getAttrPath(); @@ -62,7 +73,7 @@ UnresolvedApp Installable::toApp(EvalState & state) [&](const NixStringContextElem::DrvDeep & d) -> DerivedPath { /* We want all outputs of the drv */ return DerivedPath::Built { - .drvPath = d.drvPath, + .drvPath = makeConstantStorePathRef(d.drvPath), .outputs = OutputsSpec::All {}, }; }, @@ -77,7 +88,7 @@ UnresolvedApp Installable::toApp(EvalState & state) .path = o.path, }; }, - }, c.raw())); + }, c.raw)); } return UnresolvedApp{App { @@ -103,7 +114,7 @@ UnresolvedApp Installable::toApp(EvalState & state) auto program = outPath + "/bin/" + mainProgram; return UnresolvedApp { App { .context = { DerivedPath::Built { - .drvPath = drvPath, + .drvPath = makeConstantStorePathRef(drvPath), .outputs = OutputsSpec::Names { outputName }, } }, .program = program, |