1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-14 13:01:05 +01:00

Merge pull request #13802 from obsidiansystems/post-build-hook-later

Move `runPostBuildHook` out of `DerivationBuilder`
This commit is contained in:
John Ericson 2025-08-27 15:48:05 -04:00 committed by GitHub
commit 6c8f5ef9f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 12 deletions

View file

@ -148,6 +148,9 @@ std::string showKnownOutputs(const StoreDirConfig & store, const Derivation & dr
return msg;
}
static void runPostBuildHook(
const StoreDirConfig & store, Logger & logger, const StorePath & drvPath, const StorePathSet & outputPaths);
/* At least one of the output paths could not be
produced using a substitute. So we have to build instead. */
Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
@ -811,6 +814,11 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
outputLocks.unlock();
co_return done(std::move(ste->first), {}, std::move(ste->second));
} else if (auto * builtOutputs = std::get_if<1>(&res)) {
StorePathSet outputPaths;
for (auto & [_, output] : *builtOutputs)
outputPaths.insert(output.outPath);
runPostBuildHook(worker.store, *logger, drvPath, outputPaths);
/* It is now safe to delete the lock files, since all future
lockers will see that the output paths are valid; they will
not create new lock files with the same names as the old
@ -824,7 +832,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
#endif
}
void runPostBuildHook(
static void runPostBuildHook(
const StoreDirConfig & store, Logger & logger, const StorePath & drvPath, const StorePathSet & outputPaths)
{
auto hook = settings.postBuildHook;