1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 23:42:43 +01:00

Merge pull request #13906 from obsidiansystems/derivation-builder-simpler

More `DerivationBuilder` simplifications
This commit is contained in:
Jörg Thalheim 2025-09-10 09:58:07 +02:00 committed by GitHub
commit 7d26bf8cc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 55 deletions

View file

@ -214,9 +214,7 @@ protected:
public:
bool prepareBuild() override;
void startBuilder() override;
std::optional<Descriptor> startBuild() override;
SingleDrvOutputs unprepareBuild() override;
@ -470,19 +468,6 @@ bool DerivationBuilderImpl::killChild()
return ret;
}
bool DerivationBuilderImpl::prepareBuild()
{
if (useBuildUsers()) {
if (!buildUser)
buildUser = getBuildUser();
if (!buildUser)
return false;
}
return true;
}
SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
{
/* Since we got an EOF on the logger pipe, the builder is presumed
@ -679,8 +664,16 @@ static bool checkNotWorldWritable(std::filesystem::path path)
return true;
}
void DerivationBuilderImpl::startBuilder()
std::optional<Descriptor> DerivationBuilderImpl::startBuild()
{
if (useBuildUsers()) {
if (!buildUser)
buildUser = getBuildUser();
if (!buildUser)
return std::nullopt;
}
/* Make sure that no other processes are executing under the
sandbox uids. This must be done before any chownToBuilder()
calls. */
@ -841,9 +834,10 @@ void DerivationBuilderImpl::startBuilder()
startChild();
pid.setSeparatePG(true);
miscMethods->childStarted(builderOut.get());
processSandboxSetupMessages();
return builderOut.get();
}
PathsInChroot DerivationBuilderImpl::getPathsInSandbox()