1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Remove privateNetwork variable from local drv goal

Can just inline its definition, it was immutable.
This commit is contained in:
Las 2025-03-10 22:03:22 +00:00 committed by John Ericson
parent 87824bca6b
commit 4b521f14ac
2 changed files with 2 additions and 10 deletions

View file

@ -1032,9 +1032,6 @@ void LocalDerivationGoal::startBuilder()
us. us.
*/ */
if (derivationType->isSandboxed())
privateNetwork = true;
userNamespaceSync.create(); userNamespaceSync.create();
usingUserNamespace = userNamespacesSupported(); usingUserNamespace = userNamespacesSupported();
@ -1062,7 +1059,7 @@ void LocalDerivationGoal::startBuilder()
ProcessOptions options; ProcessOptions options;
options.cloneFlags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_PARENT | SIGCHLD; options.cloneFlags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_PARENT | SIGCHLD;
if (privateNetwork) if (derivationType->isSandboxed())
options.cloneFlags |= CLONE_NEWNET; options.cloneFlags |= CLONE_NEWNET;
if (usingUserNamespace) if (usingUserNamespace)
options.cloneFlags |= CLONE_NEWUSER; options.cloneFlags |= CLONE_NEWUSER;
@ -1879,7 +1876,7 @@ void LocalDerivationGoal::runChild()
userNamespaceSync.readSide = -1; userNamespaceSync.readSide = -1;
if (privateNetwork) { if (derivationType->isSandboxed()) {
/* Initialise the loopback interface. */ /* Initialise the loopback interface. */
AutoCloseFD fd(socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)); AutoCloseFD fd(socket(PF_INET, SOCK_DGRAM, IPPROTO_IP));

View file

@ -88,11 +88,6 @@ struct LocalDerivationGoal : public DerivationGoal
*/ */
std::shared_ptr<AutoDelete> autoDelChroot; std::shared_ptr<AutoDelete> autoDelChroot;
/**
* Whether to run the build in a private network namespace.
*/
bool privateNetwork = false;
/** /**
* Stuff we need to pass to initChild(). * Stuff we need to pass to initChild().
*/ */