Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::DarwinDerivationBuilder Struct Reference
Inheritance diagram for nix::DarwinDerivationBuilder:
nix::UnixDerivationBuilderImpl nix::DerivationBuilderImpl nix::DerivationBuilder nix::DerivationBuilderParams nix::RestrictionContext

Public Member Functions

 DarwinDerivationBuilder (std::shared_ptr< BuildingStore > store, std::shared_ptr< DerivationBuilderCallbacks > miscMethods, DerivationBuilderParams params, bool useSandbox)
void prepareSandbox () override
void setUser () override
void execBuilder (const Strings &args, const Strings &envStrs) override
void cleanupSysVIPCForUser (uid_t uid)
void killSandbox (bool getStats) override
Public Member Functions inherited from nix::UnixDerivationBuilderImpl
void cleanupOnDestruction () noexcept
std::optional< Descriptor > startBuild () override
BuilderExit unprepareBuild () override
void cleanupBuild (bool force) override
bool killChild () override
 DerivationBuilderImpl (std::shared_ptr< BuildingStore > store, std::shared_ptr< DerivationBuilderCallbacks > miscMethods, DerivationBuilderParams params)
Public Member Functions inherited from nix::DerivationBuilderImpl
 DerivationBuilderImpl (std::shared_ptr< BuildingStore > store, std::shared_ptr< DerivationBuilderCallbacks > miscMethods, DerivationBuilderParams params)
SingleDrvOutputs registerOutputs (LocalStore &localStore) override
SingleDrvOutputs checkSubmittedOutputs (LocalStore &localStore) override
Public Member Functions inherited from nix::DerivationBuilder
MuxablePipePollState::CommChannel logChannel ()
Descriptor logDescriptor ()
Public Member Functions inherited from nix::RestrictionContext
bool isAllowed (const DerivedPath &id)
void addDependency (const StorePath &path)

Public Attributes

PathsInChroot pathsInChroot
bool useSandbox
Public Attributes inherited from nix::DerivationBuilderImpl
Sync< OutputPathMap > submittedOutputs
Public Attributes inherited from nix::DerivationBuilder
AutoCloseFD builderOut
Public Attributes inherited from nix::RestrictionContext
Sync< State > state_
Public Attributes inherited from nix::DerivationBuilderParams
const StorePath & drvPath
BuildResult & buildResult
const BasicDerivation & drv
const DerivationOptions< StorePath > & drvOptions
const StorePathSet & inputPaths
const std::map< std::string, InitialOutput > initialOutputs
const BuildMode & buildMode
PathsInChroot defaultPathsInChroot
StringSet systemFeatures
DesugaredEnv desugaredEnv

Additional Inherited Members

Protected Types inherited from nix::UnixDerivationBuilderImpl
typedef StringMap Environment
Protected Types inherited from nix::DerivationBuilderImpl
typedef std::map< StorePath, StorePath > RedirectedOutputs
Protected Member Functions inherited from nix::UnixDerivationBuilderImpl
const StorePathSet & originalPaths () override
bool isAllowed (const StorePath &path) override
bool isAllowed (const DrvOutput &id) override
bool isAllowed (const DerivedPath &req)
bool shouldModifySandbox () override
void submitOutput (const SingleDerivedPath &path, const OutputName &output) override
virtual bool needsHashRewrite ()
virtual std::unique_ptr< UserLock > getBuildUser ()
PathsInChroot getPathsInSandbox ()
virtual void setBuildTmpDir ()
virtual std::filesystem::path tmpDirInSandbox ()
virtual void prepareUser ()
virtual Strings getPreBuildHookArgs ()
void openSlave ()
virtual void startChild ()
void processSandboxSetupMessages ()
void addDependencyImpl (const StorePath &path) override
void chownToBuilder (const std::filesystem::path &path)
void chownToBuilder (int fd, const std::filesystem::path &path)
void writeBuilderFile (const OsFilename &name, std::string_view contents)
void runChild (RunChildArgs args)
virtual void enterChroot ()
Protected Member Functions inherited from nix::DerivationBuilderImpl
virtual std::filesystem::path realPathInHost (const StorePath &p)
Protected Attributes inherited from nix::UnixDerivationBuilderImpl
std::filesystem::path topTmpDir
AutoCloseFD tmpDirFd
Environment env
bool usingSubmitted
AutoCloseFD daemonSocket
std::thread daemonThread
std::list< DaemonWorkerState > daemonWorkerThreads
Protected Attributes inherited from nix::DerivationBuilderImpl
Pid pid
std::shared_ptr< BuildingStore > store
std::shared_ptr< DerivationBuilderCallbacks > miscMethods
std::filesystem::path tmpDir
const derivation::Type derivationType
const LocalSettings & localSettings = store->getLocalSettings()
std::unique_ptr< UserLock > buildUser
StringMap inputRewrites
StringMap outputRewrites
RedirectedOutputs redirectedOutputs
OutputPathMap scratchOutputs
Static Protected Attributes inherited from nix::UnixDerivationBuilderImpl
static const std::filesystem::path homeDir = "/homeless-shelter"

Member Function Documentation

◆ cleanupSysVIPCForUser()

void nix::DarwinDerivationBuilder::cleanupSysVIPCForUser ( uid_t uid)

Cleans up all System V IPC objects owned by the specified user.

On Darwin, IPC objects (shared memory segments, message queues, and semaphore) can persist after the build user's processes are killed, since there are no IPC namespaces like on Linux. This can exhaust kernel IPC limits over time.

Uses sysctl to enumerate and remove all IPC objects owned by the given UID.

◆ execBuilder()

void nix::DarwinDerivationBuilder::execBuilder ( const Strings & args,
const Strings & envStrs )
overridevirtual

Execute the derivation builder process. Called by runChild() as its final step. Should not return unless there is an error.

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ killSandbox()

void nix::DarwinDerivationBuilder::killSandbox ( bool getStats)
overridevirtual

Kill any processes running under the build user UID or in the cgroup of the build.

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ prepareSandbox()

void nix::DarwinDerivationBuilder::prepareSandbox ( )
overridevirtual

Called by prepareBuild() to do any setup in the parent to prepare for a sandboxed build.

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ setUser()

void nix::DarwinDerivationBuilder::setUser ( )
overridevirtual

Change the current process's uid/gid to the build user, if any. Called by runChild().

Reimplemented from nix::UnixDerivationBuilderImpl.

Member Data Documentation

◆ useSandbox

bool nix::DarwinDerivationBuilder::useSandbox

Whether full sandboxing is enabled. Note that macOS builds always have some sandboxing (see sandbox-minimal.sb).


The documentation for this struct was generated from the following files: