1
1
#include " nix/store/build/derivation-building-goal.hh"
2
- #include " nix/store/build/derivation-goal.hh"
2
+ #include " nix/store/build/derivation-trampoline- goal.hh"
3
3
#ifndef _WIN32 // TODO enable build hook on Windows
4
4
# include " nix/store/build/hook-instance.hh"
5
5
# include " nix/store/build/derivation-builder.hh"
@@ -72,7 +72,7 @@ std::string DerivationBuildingGoal::key()
72
72
/* Ensure that derivations get built in order of their name,
73
73
i.e. a derivation named "aardvark" always comes before
74
74
"baboon". And substitution goals always happen before
75
- derivation goals (due to "b $"). */
75
+ derivation goals (due to "bd $"). */
76
76
return " bd$" + std::string (drvPath.name ()) + " $" + worker.store .printStorePath (drvPath);
77
77
}
78
78
@@ -266,7 +266,7 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
266
266
auto mEntry = get (inputGoals, drvPath);
267
267
if (!mEntry ) return std::nullopt;
268
268
269
- auto buildResult = (*mEntry )->getBuildResult (DerivedPath::Built{drvPath, OutputsSpec::Names{outputName}}) ;
269
+ auto & buildResult = (*mEntry )->buildResult ;
270
270
if (!buildResult.success ()) return std::nullopt;
271
271
272
272
auto i = get (buildResult.builtOutputs , outputName);
@@ -296,30 +296,28 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
296
296
worker.store .printStorePath (pathResolved),
297
297
});
298
298
299
- // FIXME wanted outputs
300
- auto resolvedDrvGoal = worker.makeDerivationGoal (
301
- makeConstantStorePathRef (pathResolved), OutputsSpec::All{}, buildMode);
299
+ /* TODO https://github.com/NixOS/nix/issues/13247 we should
300
+ let the calling goal do this, so it has a change to pass
301
+ just the output(s) it cares about. */
302
+ auto resolvedDrvGoal = worker.makeDerivationTrampolineGoal (
303
+ pathResolved, OutputsSpec::All{}, drvResolved, buildMode);
302
304
{
303
305
Goals waitees{resolvedDrvGoal};
304
306
co_await await (std::move (waitees));
305
307
}
306
308
307
309
trace (" resolved derivation finished" );
308
310
309
- auto resolvedDrv = *resolvedDrvGoal->drv ;
310
- auto resolvedResult = resolvedDrvGoal->getBuildResult (DerivedPath::Built{
311
- .drvPath = makeConstantStorePathRef (pathResolved),
312
- .outputs = OutputsSpec::All{},
313
- });
311
+ auto resolvedResult = resolvedDrvGoal->buildResult ;
314
312
315
313
SingleDrvOutputs builtOutputs;
316
314
317
315
if (resolvedResult.success ()) {
318
- auto resolvedHashes = staticOutputHashes (worker.store , resolvedDrv );
316
+ auto resolvedHashes = staticOutputHashes (worker.store , drvResolved );
319
317
320
318
StorePathSet outputPaths;
321
319
322
- for (auto & outputName : resolvedDrv .outputNames ()) {
320
+ for (auto & outputName : drvResolved .outputNames ()) {
323
321
auto initialOutput = get (initialOutputs, outputName);
324
322
auto resolvedHash = get (resolvedHashes, outputName);
325
323
if ((!initialOutput) || (!resolvedHash))
@@ -340,7 +338,7 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
340
338
341
339
throw Error (
342
340
" derivation '%s' doesn't have expected output '%s' (derivation-goal.cc/realisation)" ,
343
- resolvedDrvGoal-> drvReq -> to_string ( worker.store ), outputName);
341
+ worker.store . printStorePath (pathResolved ), outputName);
344
342
}();
345
343
346
344
if (!drv->type ().isImpure ()) {
0 commit comments