diff --git a/lix/legacy/build-remote.cc b/lix/legacy/build-remote.cc index d58bd249a..dbf255b6e 100644 --- a/lix/legacy/build-remote.cc +++ b/lix/legacy/build-remote.cc @@ -336,7 +336,7 @@ connected: )); auto res = aio.blockOn(sshStore->buildPathsWithResults({ DerivedPath::Built { - .drvPath = makeConstantStorePathRef(*drvPath), + .drvPath = makeConstantStorePath(*drvPath), .outputs = OutputsSpec::All {}, } })); diff --git a/lix/legacy/nix-build.cc b/lix/legacy/nix-build.cc index 2a9813513..9f3d5b02c 100644 --- a/lix/legacy/nix-build.cc +++ b/lix/legacy/nix-build.cc @@ -355,7 +355,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a auto bashDrv = drv->requireDrvPath(*state); pathsToBuild.push_back(DerivedPath::Built { - .drvPath = makeConstantStorePathRef(bashDrv), + .drvPath = makeConstantStorePath(bashDrv), .outputs = OutputsSpec::Names {"out"}, }); pathsToCopy.insert(bashDrv); @@ -368,7 +368,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a } } - auto accumDerivedPath = [&](ref inputDrv, const StringSet & inputNode) { + auto accumDerivedPath = [&](SingleDerivedPath::Opaque inputDrv, const StringSet & inputNode) { if (!inputNode.empty()) pathsToBuild.push_back(DerivedPath::Built { .drvPath = inputDrv, @@ -386,7 +386,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a return !std::regex_search(store->printStorePath(inputDrv), regex::parse(exclude)); })) { - accumDerivedPath(makeConstantStorePathRef(inputDrv), inputNode); + accumDerivedPath(makeConstantStorePath(inputDrv), inputNode); pathsToCopy.insert(inputDrv); } } @@ -571,7 +571,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath)); pathsToBuild.push_back(DerivedPath::Built{ - .drvPath = makeConstantStorePathRef(drvPath), + .drvPath = makeConstantStorePath(drvPath), .outputs = OutputsSpec::Names{outputName}, }); pathsToBuildOrdered.push_back({drvPath, {outputName}}); diff --git a/lix/legacy/nix-env.cc b/lix/legacy/nix-env.cc index 5d2b4ad7b..6a9febec6 100644 --- a/lix/legacy/nix-env.cc +++ b/lix/legacy/nix-env.cc @@ -495,7 +495,7 @@ static void printMissing(EvalState & state, DrvInfos & elems) for (auto & i : elems) if (auto drvPath = i.queryDrvPath(state)) targets.emplace_back(DerivedPath::Built{ - .drvPath = makeConstantStorePathRef(*drvPath), + .drvPath = makeConstantStorePath(*drvPath), .outputs = OutputsSpec::All { }, }); else @@ -792,7 +792,7 @@ static void opSet(Globals & globals, Strings opFlags, Strings opArgs) std::vector paths { drvPath ? (DerivedPath) (DerivedPath::Built { - .drvPath = makeConstantStorePathRef(*drvPath), + .drvPath = makeConstantStorePath(*drvPath), .outputs = OutputsSpec::All { }, }) : (DerivedPath) (DerivedPath::Opaque { diff --git a/lix/libcmd/built-path.cc b/lix/libcmd/built-path.cc index 7612dce8a..bb4c03124 100644 --- a/lix/libcmd/built-path.cc +++ b/lix/libcmd/built-path.cc @@ -13,9 +13,9 @@ namespace nix { bool MY_TYPE ::operator COMPARATOR (const MY_TYPE & other) const \ { \ const MY_TYPE* me = this; \ - auto fields1 = std::tie(*me->drvPath, me->FIELD); \ + auto fields1 = std::tie(me->drvPath, me->FIELD); \ me = &other; \ - auto fields2 = std::tie(*me->drvPath, me->FIELD); \ + auto fields2 = std::tie(me->drvPath, me->FIELD); \ return fields1 COMPARATOR fields2; \ } #define CMP(CHILD_TYPE, MY_TYPE, FIELD) \ @@ -52,7 +52,7 @@ StorePathSet BuiltPath::outPaths() const kj::Promise> BuiltPath::Built::toJSON(const Store & store) const try { JSON res; - res["drvPath"] = TRY_AWAIT(drvPath->toJSON(store)); + res["drvPath"] = TRY_AWAIT(drvPath.toJSON(store)); for (const auto & [outputName, outputPath] : outputs) { res["outputs"][outputName] = store.printStorePath(outputPath); } @@ -109,7 +109,7 @@ try { [&](const BuiltPath::Built & p) -> kj::Promise> { try { auto drvHashes = TRY_AWAIT( - staticOutputHashes(store, TRY_AWAIT(store.readDerivation(p.drvPath->path))) + staticOutputHashes(store, TRY_AWAIT(store.readDerivation(p.drvPath.path))) ); for (auto& [outputName, outputPath] : p.outputs) { if (experimentalFeatureSettings.isEnabled( @@ -118,7 +118,7 @@ try { if (!drvOutput) throw Error( "the derivation '%s' has unrealised output '%s' (derived-path.cc/toRealisedPaths)", - store.printStorePath(p.drvPath->path), outputName); + store.printStorePath(p.drvPath.path), outputName); auto thisRealisation = TRY_AWAIT(store.queryRealisation( DrvOutput{*drvOutput, outputName})); assert(thisRealisation); // We’ve built it, so we must diff --git a/lix/libcmd/built-path.hh b/lix/libcmd/built-path.hh index 8e2ace092..c9077e490 100644 --- a/lix/libcmd/built-path.hh +++ b/lix/libcmd/built-path.hh @@ -53,7 +53,7 @@ static inline ref staticDrv(StorePath drvPath) * See 'BuiltPath' for more an explanation. */ struct BuiltPathBuilt { - ref drvPath; + DerivedPathOpaque drvPath; std::map outputs; std::string to_string(const Store & store) const; diff --git a/lix/libcmd/installable-attr-path.cc b/lix/libcmd/installable-attr-path.cc index 8d733abc4..cb9fb40f3 100644 --- a/lix/libcmd/installable-attr-path.cc +++ b/lix/libcmd/installable-attr-path.cc @@ -76,7 +76,7 @@ DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths(EvalState & state) for (auto & [drvPath, outputs] : byDrvPath) res.push_back({ .path = DerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvPath), + .drvPath = makeConstantStorePath(drvPath), .outputs = outputs, }, .info = make_ref(ExtraPathInfoValue::Value { diff --git a/lix/libcmd/installable-derived-path.cc b/lix/libcmd/installable-derived-path.cc index c0477cac0..7a22e9042 100644 --- a/lix/libcmd/installable-derived-path.cc +++ b/lix/libcmd/installable-derived-path.cc @@ -35,7 +35,7 @@ InstallableDerivedPath InstallableDerivedPath::parse( // Remove this prior to stabilizing the new CLI. if (storePath.isDerivation()) { auto oldDerivedPath = DerivedPath::Built { - .drvPath = makeConstantStorePathRef(storePath), + .drvPath = makeConstantStorePath(storePath), .outputs = OutputsSpec::All { }, }; warn( @@ -48,7 +48,7 @@ InstallableDerivedPath InstallableDerivedPath::parse( }, // If the user did use ^, we just do exactly what is written. [&](const ExtendedOutputsSpec::Explicit & outputSpec) -> DerivedPath { - auto drv = make_ref(DerivedPathOpaque::parse(*store, prefix)); + auto drv = DerivedPathOpaque::parse(*store, prefix); return DerivedPath::Built { .drvPath = std::move(drv), .outputs = outputSpec, diff --git a/lix/libcmd/installable-flake.cc b/lix/libcmd/installable-flake.cc index 9586e7d24..60150c6f5 100644 --- a/lix/libcmd/installable-flake.cc +++ b/lix/libcmd/installable-flake.cc @@ -98,7 +98,7 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths(EvalState & state) return {{ .path = DerivedPath::Built { - .drvPath = makeConstantStorePathRef(std::move(drvPath)), + .drvPath = makeConstantStorePath(std::move(drvPath)), .outputs = std::visit(overloaded { [&](const ExtendedOutputsSpec::Default & d) -> OutputsSpec { std::set outputsToInstall; diff --git a/lix/libcmd/installables.cc b/lix/libcmd/installables.cc index 02b1554e2..4f9eff73c 100644 --- a/lix/libcmd/installables.cc +++ b/lix/libcmd/installables.cc @@ -759,7 +759,7 @@ StorePathSet Installable::toDerivations( : throw Error("argument '%s' did not evaluate to a derivation", i->what())); }, [&](const DerivedPath::Built & bfd) { - drvPaths.insert(bfd.drvPath->path); + drvPaths.insert(bfd.drvPath.path); }, }, b.path.raw()); diff --git a/lix/libcmd/repl.cc b/lix/libcmd/repl.cc index ae10e8eb4..a017c2177 100644 --- a/lix/libcmd/repl.cc +++ b/lix/libcmd/repl.cc @@ -760,7 +760,7 @@ ProcessLineResult NixRepl::processLine(std::string line) state.aio.blockOn(evaluator.store->buildPaths({ DerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvPath), + .drvPath = makeConstantStorePath(drvPath), .outputs = OutputsSpec::All { }, }, })); diff --git a/lix/libexpr/eval-cache.cc b/lix/libexpr/eval-cache.cc index 58f36f2b5..18c682ebc 100644 --- a/lix/libexpr/eval-cache.cc +++ b/lix/libexpr/eval-cache.cc @@ -580,7 +580,7 @@ string_t AttrCursor::getStringWithContext(EvalState & state) return d.drvPath; }, [&](const NixStringContextElem::Built & b) -> const StorePath & { - return b.drvPath->path; + return b.drvPath.path; }, [&](const NixStringContextElem::Opaque & o) -> const StorePath & { return o.path; diff --git a/lix/libexpr/eval.cc b/lix/libexpr/eval.cc index 232370850..6042b9ef3 100644 --- a/lix/libexpr/eval.cc +++ b/lix/libexpr/eval.cc @@ -922,10 +922,10 @@ std::string EvalState::mkSingleDerivedPathStringRaw( return ctx.store->printStorePath(o.path); }, [&](const SingleDerivedPath::Built & b) { - auto drv = aio.blockOn(ctx.store->readDerivation(b.drvPath->path)); + auto drv = aio.blockOn(ctx.store->readDerivation(b.drvPath.path)); auto i = drv.outputs.find(b.output); if (i == drv.outputs.end()) - throw Error("derivation '%s' does not have output '%s'", b.drvPath->to_string(*ctx.store), b.output); + throw Error("derivation '%s' does not have output '%s'", b.drvPath.to_string(*ctx.store), b.output); auto optStaticOutputPath = i->second.path(*ctx.store, drv.name, b.output); return mkOutputStringRaw(b, optStaticOutputPath); } @@ -2477,7 +2477,7 @@ SingleDerivedPath EvalState::coerceToSingleDerivedPath(const PosIdx pos, Value & [&](const SingleDerivedPath::Built & b) { ctx.errors.make( "string '%s' has context with the output '%s' from derivation '%s', but the string is not the right placeholder for this derivation output. It should be '%s'", - s, b.output, b.drvPath->to_string(*ctx.store), sExpected) + s, b.output, b.drvPath.to_string(*ctx.store), sExpected) .withTrace(pos, errorCtx).debugThrow(always_progresses); } }, derivedPath.raw()); diff --git a/lix/libexpr/primops.cc b/lix/libexpr/primops.cc index 66651640d..993a30d9f 100644 --- a/lix/libexpr/primops.cc +++ b/lix/libexpr/primops.cc @@ -58,7 +58,7 @@ StringMap EvalState::realiseContext(const NixStringContext & context) .drvPath = b.drvPath, .outputs = OutputsSpec::Names { b.output }, }); - return ensureValid(b.drvPath->path); + return ensureValid(b.drvPath.path); }, [&](const NixStringContextElem::Opaque & o) { auto ctxS = ctx.store->printStorePath(o.path); @@ -166,7 +166,7 @@ static void mkOutputString( state.mkOutputString( attrs.alloc(o.first), SingleDerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvPath), + .drvPath = makeConstantStorePath(drvPath), .output = o.first, }, o.second.path(*state.ctx.store, Derivation::nameFromPath(drvPath), o.first)); @@ -977,7 +977,7 @@ drvName, Bindings * attrs, Value & v) } }, [&](const NixStringContextElem::Built & b) { - drv.inputDrvs[b.drvPath->path].insert(b.output); + drv.inputDrvs[b.drvPath.path].insert(b.output); }, [&](const NixStringContextElem::Opaque & o) { drv.inputSrcs.insert(o.path); diff --git a/lix/libexpr/primops/context.cc b/lix/libexpr/primops/context.cc index 4f7c8280c..746e3a108 100644 --- a/lix/libexpr/primops/context.cc +++ b/lix/libexpr/primops/context.cc @@ -127,7 +127,7 @@ void prim_getContext(EvalState & state, Value * * args, Value & v) contextInfos[std::move(d.drvPath)].allOutputs = true; }, [&](NixStringContextElem::Built && b) { - auto drvPath = b.drvPath->path; + auto drvPath = b.drvPath.path; contextInfos[std::move(drvPath)].outputs.emplace_back(std::move(b.output)); }, [&](NixStringContextElem::Opaque && o) { @@ -217,7 +217,7 @@ static void prim_appendContext(EvalState & state, Value * * args, Value & v) for (auto elem : iter->value->listItems()) { auto outputName = state.forceStringNoCtx(*elem, iter->pos, "while evaluating an output name within a string context"); context.emplace(NixStringContextElem::Built { - .drvPath = makeConstantStorePathRef(namePath), + .drvPath = makeConstantStorePath(namePath), .output = std::string { outputName }, }); } diff --git a/lix/libexpr/value/context.cc b/lix/libexpr/value/context.cc index 97398e948..5d82a9518 100644 --- a/lix/libexpr/value/context.cc +++ b/lix/libexpr/value/context.cc @@ -26,7 +26,7 @@ NixStringContextElem NixStringContextElem::parse(std::string_view s0) std::string output { s.substr(0, index) }; // Advance string to parse after the '!' s = s.substr(index + 1); - auto drv = make_ref(SingleDerivedPath::Opaque{StorePath{s}}); + auto drv = SingleDerivedPath::Opaque{StorePath{s}}; return SingleDerivedPath::Built{ .drvPath = std::move(drv), .output = std::move(output), @@ -59,7 +59,7 @@ std::string NixStringContextElem::to_string() const res += '!'; res += b.output; res += '!'; - res += b.drvPath->path.to_string(); + res += b.drvPath.path.to_string(); }, [&](const NixStringContextElem::Opaque & o) { res += o.path.to_string(); diff --git a/lix/libstore/build/derivation-goal.cc b/lix/libstore/build/derivation-goal.cc index 186b6e99d..3b321472a 100644 --- a/lix/libstore/build/derivation-goal.cc +++ b/lix/libstore/build/derivation-goal.cc @@ -74,7 +74,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath, { name = fmt( "building of '%s' from .drv file", - DerivedPath::Built { makeConstantStorePathRef(drvPath), wantedOutputs }.to_string(worker.store)); + DerivedPath::Built { makeConstantStorePath(drvPath), wantedOutputs }.to_string(worker.store)); trace("created"); mcExpectedBuilds = worker.expectedBuilds.addTemporarily(1); @@ -93,7 +93,7 @@ DerivationGoal::DerivationGoal(DrvHasRoot, const StorePath & drvPath, const Basi name = fmt( "building of '%s' from in-memory derivation", - DerivedPath::Built { makeConstantStorePathRef(drvPath), drv.outputNames() }.to_string(worker.store)); + DerivedPath::Built { makeConstantStorePath(drvPath), drv.outputNames() }.to_string(worker.store)); trace("created"); mcExpectedBuilds = worker.expectedBuilds.addTemporarily(1); @@ -373,7 +373,7 @@ try { /* The inputs must be built before we can build this goal. */ inputDrvOutputs.clear(); if (useDerivation) { - auto addWaiteeDerivedPath = [&](ref inputDrv, const StringSet & inputNode) { + auto addWaiteeDerivedPath = [&](DerivedPathOpaque inputDrv, const StringSet & inputNode) { if (!inputNode.empty()) dependencies.add(worker.goalFactory().makeGoal( DerivedPath::Built { @@ -384,7 +384,7 @@ try { }; for (const auto & [inputDrvPath, inputNode] : dynamic_cast(drv.get())->inputDrvs) { - addWaiteeDerivedPath(makeConstantStorePathRef(inputDrvPath), inputNode); + addWaiteeDerivedPath(makeConstantStorePath(inputDrvPath), inputNode); } } @@ -465,7 +465,7 @@ try { else dependencies.add(worker.goalFactory().makeGoal( DerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvPath2->second), + .drvPath = makeConstantStorePath(drvPath2->second), .outputs = OutputsSpec::All { }, }, bmRepair)); @@ -1762,7 +1762,7 @@ void DerivationGoal::waiteeDone(GoalPtr waitee) for (auto & outputName : outputs) { auto buildResult = dg->buildResult.restrictTo(DerivedPath::Built { - .drvPath = makeConstantStorePathRef(dg->drvPath), + .drvPath = makeConstantStorePath(dg->drvPath), .outputs = OutputsSpec::Names { outputName }, }); if (buildResult.success()) { diff --git a/lix/libstore/build/entry-points.cc b/lix/libstore/build/entry-points.cc index 98e8e533b..ad25de71e 100644 --- a/lix/libstore/build/entry-points.cc +++ b/lix/libstore/build/entry-points.cc @@ -93,7 +93,7 @@ try { })); auto & result = results.goals.begin()->second; co_return result.result.restrictTo(DerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvPath), + .drvPath = makeConstantStorePath(drvPath), .outputs = OutputsSpec::All {}, }); } catch (Error & e) { @@ -151,7 +151,7 @@ try { Worker::Targets goals; goals.emplace_back(gf.makeGoal( DerivedPath::Built{ - .drvPath = makeConstantStorePathRef(*info->deriver), + .drvPath = makeConstantStorePath(*info->deriver), // FIXME: Should just build the specific output we need. .outputs = OutputsSpec::All{}, }, diff --git a/lix/libstore/build/worker.cc b/lix/libstore/build/worker.cc index 2e308ae46..4c6eadbb4 100644 --- a/lix/libstore/build/worker.cc +++ b/lix/libstore/build/worker.cc @@ -201,7 +201,7 @@ std::pair>> Worker::makeGoal(const { return std::visit(overloaded { [&](const DerivedPath::Built & bfd) -> std::pair>> { - return makeDerivationGoal(bfd.drvPath->path, bfd.outputs, buildMode); + return makeDerivationGoal(bfd.drvPath.path, bfd.outputs, buildMode); }, [&](const DerivedPath::Opaque & bo) -> std::pair>> { return makePathSubstitutionGoal(bo.path, buildMode == bmRepair ? Repair : NoRepair); diff --git a/lix/libstore/derived-path.cc b/lix/libstore/derived-path.cc index d76f973df..5867a0524 100644 --- a/lix/libstore/derived-path.cc +++ b/lix/libstore/derived-path.cc @@ -10,9 +10,9 @@ namespace nix { bool MY_TYPE ::operator COMPARATOR (const MY_TYPE & other) const \ { \ const MY_TYPE* me = this; \ - auto fields1 = std::tie(*me->drvPath, me->FIELD); \ + auto fields1 = std::tie(me->drvPath, me->FIELD); \ me = &other; \ - auto fields2 = std::tie(*me->drvPath, me->FIELD); \ + auto fields2 = std::tie(me->drvPath, me->FIELD); \ return fields1 COMPARATOR fields2; \ } #define CMP(CHILD_TYPE, MY_TYPE, FIELD) \ @@ -37,10 +37,10 @@ try { kj::Promise> DerivedPath::Built::toJSON(Store & store) const try { JSON res; - res["drvPath"] = TRY_AWAIT(drvPath->toJSON(store)); + res["drvPath"] = TRY_AWAIT(drvPath.toJSON(store)); // Fallback for the input-addressed derivation case: We expect to always be // able to print the output paths, so let’s do it - const auto outputMap = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath->path)); + const auto outputMap = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath.path)); for (const auto & [output, outputPathOpt] : outputMap) { if (!outputs.contains(output)) continue; if (outputPathOpt) @@ -60,14 +60,14 @@ std::string DerivedPath::Opaque::to_string(const Store & store) const std::string DerivedPath::Built::to_string(const Store & store) const { - return drvPath->to_string(store) + return drvPath.to_string(store) + '^' + outputs.to_string(); } std::string DerivedPath::Built::to_string_legacy(const Store & store) const { - return drvPath->to_string(store) + return drvPath.to_string(store) + "!" + outputs.to_string(); } @@ -94,11 +94,11 @@ DerivedPath::Opaque DerivedPath::Opaque::parse(const Store & store, std::string_ } DerivedPath::Built DerivedPath::Built::parse( - const Store & store, ref drv, + const Store & store, DerivedPathOpaque drv, OutputNameView outputsS) { return { - .drvPath = drv, + .drvPath = std::move(drv), .outputs = OutputsSpec::parse(outputsS), }; } @@ -112,12 +112,10 @@ static DerivedPathT parseDerivedPath( return DerivedPathT::Opaque::parse(store, s); } else { auto path = DerivedPathT::Built::parse(store, - make_ref(DerivedPathT::Opaque::parse( - store, - s.substr(0, n))), + DerivedPathT::Opaque::parse(store, s.substr(0, n)), s.substr(n + 1)); - const auto& basePath = path.drvPath->path; + const auto& basePath = path.drvPath.path; if (!basePath.isDerivation()) { throw InvalidPath("cannot use output selection ('%s') on non-derivation store path '%s'", separator, basePath.to_string()); @@ -152,7 +150,7 @@ static inline const StorePath & getBaseStorePath_(const DP & derivedPath) { return std::visit(overloaded { [&](const typename DP::Built & bfd) -> const StorePath & { - return bfd.drvPath->path; + return bfd.drvPath.path; }, [&](const typename DP::Opaque & bo) -> const StorePath & { return bo.path; diff --git a/lix/libstore/derived-path.hh b/lix/libstore/derived-path.hh index ec49f3ba7..bc9143df1 100644 --- a/lix/libstore/derived-path.hh +++ b/lix/libstore/derived-path.hh @@ -43,7 +43,7 @@ struct SingleDerivedPath; * path of the given output name. */ struct SingleDerivedPathBuilt { - ref drvPath; + DerivedPathOpaque drvPath; OutputName output; DECLARE_CMP(SingleDerivedPathBuilt); @@ -79,9 +79,9 @@ struct SingleDerivedPath : derived_path::detail::SingleDerivedPathRaw { } }; -static inline ref makeConstantStorePathRef(StorePath drvPath) +static inline DerivedPathOpaque makeConstantStorePath(StorePath drvPath) { - return make_ref(SingleDerivedPath::Opaque { drvPath }); + return SingleDerivedPath::Opaque { std::move(drvPath) }; } /** @@ -97,7 +97,7 @@ static inline ref makeConstantStorePathRef(StorePath drvPath) * output name. */ struct DerivedPathBuilt { - ref drvPath; + DerivedPathOpaque drvPath; OutputsSpec outputs; /** @@ -111,7 +111,7 @@ struct DerivedPathBuilt { /** * The caller splits on the separator, so it works for both variants. */ - static DerivedPathBuilt parse(const Store & store, ref, std::string_view); + static DerivedPathBuilt parse(const Store & store, DerivedPathOpaque, std::string_view); kj::Promise> toJSON(Store & store) const; DECLARE_CMP(DerivedPathBuilt); diff --git a/lix/libstore/downstream-placeholder.cc b/lix/libstore/downstream-placeholder.cc index 82ff2f1b0..d113128ed 100644 --- a/lix/libstore/downstream-placeholder.cc +++ b/lix/libstore/downstream-placeholder.cc @@ -27,7 +27,7 @@ DownstreamPlaceholder DownstreamPlaceholder::fromSingleDerivedPathBuilt( const SingleDerivedPath::Built & b, const ExperimentalFeatureSettings & xpSettings) { - return DownstreamPlaceholder::unknownCaOutput(b.drvPath->path, b.output, xpSettings); + return DownstreamPlaceholder::unknownCaOutput(b.drvPath.path, b.output, xpSettings); } } diff --git a/lix/libstore/misc.cc b/lix/libstore/misc.cc index ef11a6ac7..2717e0c7c 100644 --- a/lix/libstore/misc.cc +++ b/lix/libstore/misc.cc @@ -150,10 +150,10 @@ struct QueryMissingContext kj::Promise> queryMissing(const std::vector & targets); - void enqueueDerivedPaths(ref inputDrv, const StringSet & inputNode) + void enqueueDerivedPaths(DerivedPathOpaque inputDrv, const StringSet & inputNode) { if (!inputNode.empty()) { - pool.enqueueWithAio([this, path{DerivedPath::Built{inputDrv, inputNode}}]( + pool.enqueueWithAio([this, path{DerivedPath::Built{std::move(inputDrv), inputNode}}]( AsyncIoRoot & aio ) { doPath(aio, path); }); } @@ -167,7 +167,7 @@ struct QueryMissingContext } for (const auto & [inputDrv, inputNode] : drv.inputDrvs) { - enqueueDerivedPaths(makeConstantStorePathRef(inputDrv), inputNode); + enqueueDerivedPaths(makeConstantStorePath(inputDrv), inputNode); } } @@ -230,7 +230,7 @@ struct QueryMissingContext void doPathBuilt(AsyncIoRoot & aio, const DerivedPath::Built & bfd) { - auto & drvPath = bfd.drvPath->path; + auto & drvPath = bfd.drvPath.path; if (!aio.blockOn(store.isValidPath(drvPath))) { // FIXME: we could try to substitute the derivation. @@ -457,7 +457,7 @@ try { kj::Promise> resolveDerivedPath(Store & store, const DerivedPath::Built & bfd, Store * evalStore_) try { - auto drvPath = bfd.drvPath->path; + auto drvPath = bfd.drvPath.path; auto outputsOpt_ = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath, evalStore_)); @@ -474,7 +474,7 @@ try { if (!pOutputPathOpt) throw Error( "the derivation '%s' doesn't have an output named '%s'", - bfd.drvPath->to_string(store), output); + bfd.drvPath.to_string(store), output); outputsOpt.insert_or_assign(output, std::move(*pOutputPathOpt)); } return outputsOpt; @@ -484,7 +484,7 @@ try { OutputPathMap outputs; for (auto & [outputName, outputPathOpt] : outputsOpt) { if (!outputPathOpt) - throw MissingRealisation(bfd.drvPath->to_string(store), outputName); + throw MissingRealisation(bfd.drvPath.to_string(store), outputName); auto & outputPath = *outputPathOpt; outputs.insert_or_assign(outputName, outputPath); } @@ -506,7 +506,7 @@ try { // NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines) [&](const SingleDerivedPath::Built & bfd) -> kj::Promise> { try { - auto drvPath = bfd.drvPath->path; + auto drvPath = bfd.drvPath.path; auto outputPaths = TRY_AWAIT(evalStore.queryPartialDerivationOutputMap(drvPath, evalStore_)); if (outputPaths.count(bfd.output) == 0) @@ -514,7 +514,7 @@ try { store.printStorePath(drvPath), bfd.output); auto & optPath = outputPaths.at(bfd.output); if (!optPath) - throw MissingRealisation(bfd.drvPath->to_string(store), bfd.output); + throw MissingRealisation(bfd.drvPath.to_string(store), bfd.output); co_return *optPath; } catch (...) { co_return result::current_exception(); diff --git a/lix/libstore/path-with-outputs.cc b/lix/libstore/path-with-outputs.cc index e97ddb60e..75d50f057 100644 --- a/lix/libstore/path-with-outputs.cc +++ b/lix/libstore/path-with-outputs.cc @@ -16,13 +16,13 @@ DerivedPath StorePathWithOutputs::toDerivedPath() const { if (!outputs.empty()) { return DerivedPath::Built { - .drvPath = makeConstantStorePathRef(path), + .drvPath = makeConstantStorePath(path), .outputs = OutputsSpec::Names { outputs }, }; } else if (path.isDerivation()) { assert(outputs.empty()); return DerivedPath::Built { - .drvPath = makeConstantStorePathRef(path), + .drvPath = makeConstantStorePath(path), .outputs = OutputsSpec::All { }, }; } else { @@ -51,7 +51,7 @@ StorePathWithOutputs::ParseResult StorePathWithOutputs::tryFromDerivedPath(const }, [&](const DerivedPath::Built & bfd) -> StorePathWithOutputs::ParseResult { return StorePathWithOutputs { - .path = bfd.drvPath->path, + .path = bfd.drvPath.path, // Use legacy encoding of wildcard as empty set .outputs = std::visit(overloaded { [&](const OutputsSpec::All &) -> StringSet { diff --git a/lix/libstore/remote-store.cc b/lix/libstore/remote-store.cc index e996cfd75..ec632c512 100644 --- a/lix/libstore/remote-store.cc +++ b/lix/libstore/remote-store.cc @@ -667,7 +667,7 @@ try { // Do nothing, path is hopefully there already }, [&](const DerivedPath::Built & bp) { - drvPaths2.insert(bp.drvPath->path); + drvPaths2.insert(bp.drvPath.path); }, }, i.raw()); } @@ -748,7 +748,7 @@ try { }; OutputPathMap outputs; - auto drvPath = bfd.drvPath->path; + auto drvPath = bfd.drvPath.path; auto drv = TRY_AWAIT(evalStore->readDerivation(drvPath)); const auto outputHashes = TRY_AWAIT(staticOutputHashes(*evalStore, drv)); // FIXME: expensive diff --git a/lix/nix/app.cc b/lix/nix/app.cc index 9ca4a37ba..4acb49675 100644 --- a/lix/nix/app.cc +++ b/lix/nix/app.cc @@ -27,7 +27,7 @@ StringPairs resolveRewrites( res.emplace( DownstreamPlaceholder::fromSingleDerivedPathBuilt( SingleDerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvDep->drvPath->path), + .drvPath = makeConstantStorePath(drvDep->drvPath.path), .output = outputName, }).render(), store.printStorePath(outputPath) @@ -73,7 +73,7 @@ UnresolvedApp InstallableValue::toApp(EvalState & state) [&](const NixStringContextElem::DrvDeep & d) -> DerivedPath { /* We want all outputs of the drv */ return DerivedPath::Built { - .drvPath = makeConstantStorePathRef(d.drvPath), + .drvPath = makeConstantStorePath(d.drvPath), .outputs = OutputsSpec::All {}, }; }, @@ -114,7 +114,7 @@ UnresolvedApp InstallableValue::toApp(EvalState & state) auto program = outPath + "/bin/" + mainProgram; return UnresolvedApp { App { .context = { DerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvPath), + .drvPath = makeConstantStorePath(drvPath), .outputs = OutputsSpec::Names { outputName }, } }, .program = program, diff --git a/lix/nix/bundle.cc b/lix/nix/bundle.cc index 77ed7a7a8..b322b5842 100644 --- a/lix/nix/bundle.cc +++ b/lix/nix/bundle.cc @@ -117,7 +117,7 @@ struct CmdBundle : InstallableCommand aio().blockOn(store->buildPaths({ DerivedPath::Built { - .drvPath = makeConstantStorePathRef(drvPath), + .drvPath = makeConstantStorePath(drvPath), .outputs = OutputsSpec::All { }, }, })); diff --git a/lix/nix/develop.cc b/lix/nix/develop.cc index 52a6f5d4f..bb107d51c 100644 --- a/lix/nix/develop.cc +++ b/lix/nix/develop.cc @@ -262,7 +262,7 @@ try { /* Build the derivation. */ TRY_AWAIT(store->buildPaths( { DerivedPath::Built { - .drvPath = makeConstantStorePathRef(shellDrvPath), + .drvPath = makeConstantStorePath(shellDrvPath), .outputs = OutputsSpec::All { }, }}, bmNormal, evalStore)); diff --git a/lix/nix/flake.cc b/lix/nix/flake.cc index cbc0e2d75..11ae925ca 100644 --- a/lix/nix/flake.cc +++ b/lix/nix/flake.cc @@ -615,7 +615,7 @@ struct CmdFlakeCheck : FlakeCommand *attr2.value, attr2.pos); if (drvPath && attr_name == evalSettings.getCurrentSystem()) { drvPaths.push_back(DerivedPath::Built { - .drvPath = makeConstantStorePathRef(*drvPath), + .drvPath = makeConstantStorePath(*drvPath), .outputs = OutputsSpec::All { }, }); } diff --git a/lix/nix/log.cc b/lix/nix/log.cc index 31f53c6da..6277a01ab 100644 --- a/lix/nix/log.cc +++ b/lix/nix/log.cc @@ -39,7 +39,7 @@ struct CmdLog : InstallableCommand return bo.path; }, [&](const DerivedPath::Built & bfd) { - return bfd.drvPath->path; + return bfd.drvPath.path; }, }, b.path.raw()); diff --git a/subprojects/nix-eval-jobs/src/worker.cc b/subprojects/nix-eval-jobs/src/worker.cc index e10a39378..da8834d31 100644 --- a/subprojects/nix-eval-jobs/src/worker.cc +++ b/subprojects/nix-eval-jobs/src/worker.cc @@ -99,7 +99,7 @@ readConstituents(const nix::Value *v, nix::box_ptr &state, std::visit(nix::overloaded{ [&](const nix::NixStringContextElem::Built &b) { constituents.push_back( - b.drvPath->to_string(*evaluator->store)); + b.drvPath.to_string(*evaluator->store)); }, [&](const nix::NixStringContextElem::Opaque &) {}, [&](const nix::NixStringContextElem::DrvDeep &) {}, diff --git a/tests/functional/test-libstoreconsumer/main.cc b/tests/functional/test-libstoreconsumer/main.cc index fb1b54a8e..a743e9538 100644 --- a/tests/functional/test-libstoreconsumer/main.cc +++ b/tests/functional/test-libstoreconsumer/main.cc @@ -25,7 +25,7 @@ int main (int argc, char **argv) std::vector paths { DerivedPath::Built { - .drvPath = makeConstantStorePathRef(store->parseStorePath(drvPath)), + .drvPath = makeConstantStorePath(store->parseStorePath(drvPath)), .outputs = OutputsSpec::Names{"out"} } }; diff --git a/tests/unit/libexpr/value/context.cc b/tests/unit/libexpr/value/context.cc index 9c775d6fc..99f78c43c 100644 --- a/tests/unit/libexpr/value/context.cc +++ b/tests/unit/libexpr/value/context.cc @@ -78,7 +78,7 @@ TEST(NixStringContextElemTest, built_opaque) { auto * p = std::get_if(&elem.raw); ASSERT_TRUE(p); ASSERT_EQ(p->output, "foo"); - ASSERT_EQ(*p->drvPath, (SingleDerivedPath::Opaque { + ASSERT_EQ(p->drvPath, (SingleDerivedPath::Opaque { .path = StorePath { built.substr(5) }, })); ASSERT_EQ(elem.to_string(), built); diff --git a/tests/unit/libstore-support/tests/derived-path.cc b/tests/unit/libstore-support/tests/derived-path.cc index c026711bb..853d368b9 100644 --- a/tests/unit/libstore-support/tests/derived-path.cc +++ b/tests/unit/libstore-support/tests/derived-path.cc @@ -20,7 +20,7 @@ Gen Arbitrary::arbitrary() Gen Arbitrary::arbitrary() { return gen::just(SingleDerivedPath::Built { - .drvPath = make_ref(*gen::arbitrary()), + .drvPath = *gen::arbitrary(), .output = (*gen::arbitrary()).name, }); } @@ -28,7 +28,7 @@ Gen Arbitrary::arbitrary() Gen Arbitrary::arbitrary() { return gen::just(DerivedPath::Built { - .drvPath = make_ref(*gen::arbitrary()), + .drvPath = *gen::arbitrary(), .outputs = *gen::arbitrary(), }); } diff --git a/tests/unit/libstore/worker-protocol.cc b/tests/unit/libstore/worker-protocol.cc index e7adcd1d8..80d0c9a21 100644 --- a/tests/unit/libstore/worker-protocol.cc +++ b/tests/unit/libstore/worker-protocol.cc @@ -76,13 +76,13 @@ VERSIONED_CHARACTERIZATION_TEST( .path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" }, }, DerivedPath::Built { - .drvPath = makeConstantStorePathRef(StorePath { + .drvPath = makeConstantStorePath(StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", }), .outputs = OutputsSpec::All { }, }, DerivedPath::Built { - .drvPath = makeConstantStorePathRef(StorePath { + .drvPath = makeConstantStorePath(StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", }), .outputs = OutputsSpec::Names { "x", "y" }, @@ -102,13 +102,13 @@ VERSIONED_CHARACTERIZATION_TEST( .path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv" }, }, DerivedPath::Built { - .drvPath = makeConstantStorePathRef(StorePath { + .drvPath = makeConstantStorePath(StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", }), .outputs = OutputsSpec::All { }, }, DerivedPath::Built { - .drvPath = makeConstantStorePathRef(StorePath { + .drvPath = makeConstantStorePath(StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", }), .outputs = OutputsSpec::Names { "x", "y" }, @@ -318,7 +318,7 @@ VERSIONED_CHARACTERIZATION_TEST( .stopTime = 50, }, /* .path = */ DerivedPath::Built { - .drvPath = makeConstantStorePathRef(StorePath { + .drvPath = makeConstantStorePath(StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", }), .outputs = OutputsSpec::Names { "out" },