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

Public Member Functions

 ChrootLinuxDerivationBuilder (std::shared_ptr< BuildingStore > store, std::shared_ptr< DerivationBuilderCallbacks > miscMethods, DerivationBuilderParams params)
uid_t sandboxUid ()
gid_t sandboxGid () override
std::unique_ptr< UserLock > getBuildUser () override
void prepareUser () override
void prepareSandbox () override
void startChild () override
void enterChroot () override
void setUser () override
BuilderExit unprepareBuild () override
void killSandbox (bool getStats) override
void addDependencyImpl (const StorePath &path) override
Public Member Functions inherited from nix::ChrootDerivationBuilder
 ChrootDerivationBuilder (std::shared_ptr< BuildingStore > store, std::shared_ptr< DerivationBuilderCallbacks > miscMethods, DerivationBuilderParams params)
bool needsHashRewrite () override
void setBuildTmpDir () override
std::filesystem::path tmpDirInSandbox () override
Strings getPreBuildHookArgs () override
std::filesystem::path realPathInHost (const StorePath &p) override
void cleanupBuild (bool force) override
std::pair< std::filesystem::path, std::filesystem::path > addDependencyPrep (const StorePath &path)
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 Member Functions inherited from nix::LinuxDerivationBuilder
void enterChroot () override

Public Attributes

Pipe userNamespaceSync
AutoCloseFD sandboxMountNamespace
AutoCloseFD sandboxUserNamespace
bool usingUserNamespace = true
std::optional< std::filesystem::path > cgroup
Public Attributes inherited from nix::ChrootDerivationBuilder
std::filesystem::path chrootRootDir
std::optional< AutoDelete > autoDelChroot
PathsInChroot pathsInChroot
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
PathsInChroot getPathsInSandbox ()
void openSlave ()
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 execBuilder (const Strings &args, const Strings &envStrs)
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

◆ addDependencyImpl()

void nix::ChrootLinuxDerivationBuilder::addDependencyImpl ( const StorePath & path)
overridevirtual

This is the underlying implementation to be defined. The caller will ensure that this is only called on newly added dependencies, and that idempotent calls are a no-op.

Implements nix::RestrictionContext.

◆ enterChroot()

void nix::ChrootLinuxDerivationBuilder::enterChroot ( )
overridevirtual

Move the current process into the chroot, if any. Called early by runChild().

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ getBuildUser()

std::unique_ptr< UserLock > nix::ChrootLinuxDerivationBuilder::getBuildUser ( )
overridevirtual

Acquire a build user lock. Return nullptr if no lock is available.

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ killSandbox()

void nix::ChrootLinuxDerivationBuilder::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::ChrootLinuxDerivationBuilder::prepareSandbox ( )
overridevirtual

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

Reimplemented from nix::ChrootDerivationBuilder.

◆ prepareUser()

void nix::ChrootLinuxDerivationBuilder::prepareUser ( )
overridevirtual

Ensure that there are no processes running that conflict with buildUser.

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ sandboxGid()

gid_t nix::ChrootLinuxDerivationBuilder::sandboxGid ( )
overridevirtual

Reimplemented from nix::ChrootDerivationBuilder.

◆ setUser()

void nix::ChrootLinuxDerivationBuilder::setUser ( )
overridevirtual

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

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ startChild()

void nix::ChrootLinuxDerivationBuilder::startChild ( )
overridevirtual

Called by prepareBuild() to start the child process for the build. Must set pid. The child must call runChild().

Reimplemented from nix::UnixDerivationBuilderImpl.

◆ unprepareBuild()

BuilderExit nix::ChrootLinuxDerivationBuilder::unprepareBuild ( )
overridevirtual

Tear down build environment after the builder exits (either on its own or if it is killed).

Returns
The builder's exit status and whether the disk seemed full at exit time.

Implements nix::DerivationBuilder.

Member Data Documentation

◆ cgroup

std::optional<std::filesystem::path> nix::ChrootLinuxDerivationBuilder::cgroup

The cgroup of the builder, if any.

◆ sandboxMountNamespace

AutoCloseFD nix::ChrootLinuxDerivationBuilder::sandboxMountNamespace

The mount namespace and user namespace of the builder, used to add additional paths to the sandbox as a result of recursive Nix calls.

◆ userNamespaceSync

Pipe nix::ChrootLinuxDerivationBuilder::userNamespaceSync

Pipe for synchronising updates to the builder namespaces.

◆ usingUserNamespace

bool nix::ChrootLinuxDerivationBuilder::usingUserNamespace = true

On Linux, whether we're doing the build in its own user namespace.


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