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

Merge remote-tracking branch 'detsys/external-builder-under-build-user' into refactor-derivation-builder

This commit is contained in:
Eelco Dolstra 2025-07-17 17:27:47 +02:00
commit e290b52613

View file

@ -29,9 +29,7 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
bool prepareBuild() override bool prepareBuild() override
{ {
// External builds don't use build users, so this always return DerivationBuilderImpl::prepareBuild();
// succeeds.
return true;
} }
Path tmpDirInSandbox() override Path tmpDirInSandbox() override
@ -49,7 +47,12 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
void prepareUser() override void prepareUser() override
{ {
// Nothing to do here since we don't have a build user. DerivationBuilderImpl::prepareUser();
}
void setUser() override
{
DerivationBuilderImpl::setUser();
} }
void checkSystem() override void checkSystem() override
@ -103,6 +106,13 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
args.insert(args.end(), jsonFile); args.insert(args.end(), jsonFile);
if (chdir(tmpDir.c_str()) == -1)
throw SysError("changing into '%1%'", tmpDir);
chownToBuilder(topTmpDir);
setUser();
debug("executing external builder: %s", concatStringsSep(" ", args)); debug("executing external builder: %s", concatStringsSep(" ", args));
execv(externalBuilder.program.c_str(), stringsToCharPtrs(args).data()); execv(externalBuilder.program.c_str(), stringsToCharPtrs(args).data());