1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Move autoDelChroot

This commit is contained in:
Eelco Dolstra 2025-05-26 22:23:59 +02:00
parent 9e2151d839
commit c9b55fa3f0
2 changed files with 12 additions and 9 deletions

View file

@ -175,6 +175,11 @@ struct LinuxDerivationBuilder : DerivationBuilderImpl
*/
Path chrootRootDir;
/**
* RAII object to delete the chroot directory.
*/
std::shared_ptr<AutoDelete> autoDelChroot;
PathsInChroot pathsInChroot;
LinuxDerivationBuilder(
@ -183,6 +188,13 @@ struct LinuxDerivationBuilder : DerivationBuilderImpl
{
}
void deleteTmpDir(bool force) override
{
autoDelChroot.reset(); /* this runs the destructor */
DerivationBuilderImpl::deleteTmpDir(force);
}
uid_t sandboxUid()
{
return usingUserNamespace ? (!buildUser || buildUser->getUIDCount() == 1 ? 1000 : 0) : buildUser->getUID();