Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::DerivationGoal Struct Reference

#include <derivation-goal.hh>

Inheritance diagram for nix::DerivationGoal:
nix::Goal nix::LocalDerivationGoal

Classes

struct  DrvHasRoot
struct  InputStream

Public Types

enum struct  NeedRestartForMoreOutputs { OutputsAddedDoNeed , BuildInProgressWillNotNeed }
enum  RetrySubstitution { NoNeed , YesNeed , AlreadyRetried }
Public Types inherited from nix::Goal
enum  ExitCode { ecSuccess , ecFailed , ecNoSubstituters , ecIncompleteClosure }

Public Member Functions

 DerivationGoal (const StorePath &drvPath, const OutputsSpec &wantedOutputs, Worker &worker, bool isDependency, BuildMode buildMode=bmNormal)
 DerivationGoal (DrvHasRoot, const StorePath &drvPath, const BasicDerivation &drv, const OutputsSpec &wantedOutputs, Worker &worker, bool isDependency, BuildMode buildMode=bmNormal)
WorkResult timedOut (Error &&ex)
kj::Promise< Result< WorkResult > > workImpl () noexcept override
bool addWantedOutputs (const OutputsSpec &outputs)
kj::Promise< Result< WorkResult > > getDerivation () noexcept
kj::Promise< Result< WorkResult > > loadDerivation () noexcept
kj::Promise< Result< WorkResult > > haveDerivation () noexcept
kj::Promise< Result< WorkResult > > outputsSubstitutionTried () noexcept
kj::Promise< Result< WorkResult > > gaveUpOnSubstitution () noexcept
kj::Promise< Result< WorkResult > > closureRepaired () noexcept
kj::Promise< Result< WorkResult > > inputsRealised () noexcept
kj::Promise< Result< WorkResult > > tryToBuild () noexcept
virtual kj::Promise< Result< WorkResult > > tryLocalBuild () noexcept
kj::Promise< Result< WorkResult > > buildDone () noexcept
kj::Promise< Result< WorkResult > > resolvedFinished () noexcept
HookReply tryBuildHook ()
virtual int getChildStatus ()
virtual kj::Promise< Result< SingleDrvOutputs > > registerOutputs ()
Path openLogFile ()
virtual void signRealisation (Realisation &)
void closeLogFile ()
virtual void closeReadPipes ()
virtual void cleanupHookFinally ()
virtual void cleanupPreChildKill ()
virtual void cleanupPostChildKill ()
virtual bool cleanupDecideWhetherDiskFull ()
virtual void cleanupPostOutputsRegisteredModeCheck ()
virtual void cleanupPostOutputsRegisteredModeNonCheck ()
kj::Promise< Result< std::map< std::string, std::optional< StorePath > > > > queryPartialDerivationOutputMap ()
kj::Promise< Result< OutputPathMap > > queryDerivationOutputMap ()
kj::Promise< Result< std::pair< bool, SingleDrvOutputs > > > checkPathValidity ()
kj::Promise< Result< SingleDrvOutputs > > assertPathValidity ()
virtual void killChild ()
kj::Promise< Result< WorkResult > > repairClosure () noexcept
void started ()
WorkResult done (BuildResult::Status status, SingleDrvOutputs builtOutputs={}, std::optional< Error > ex={})
void waiteeDone (GoalPtr waitee) override
virtual bool respectsTimeouts ()
StorePathSet exportReferences (const StorePathSet &storePaths)
JobCategory jobCategory () const override
 Hint for the scheduler, which concurrency limit applies.
Public Member Functions inherited from nix::Goal
 Goal (Worker &worker, bool isDependency)
kj::Promise< Result< WorkResult > > work () noexcept
void trace (std::string_view s)
std::string getName () const
virtual void cleanup ()

Public Attributes

bool isDone = false
bool useDerivation
StorePath drvPath
std::shared_ptr< DerivationGoal > resolvedDrvGoal
OutputsSpec wantedOutputs
std::map< std::pair< StorePath, std::string >, StorePathinputDrvOutputs
NeedRestartForMoreOutputs needRestart = NeedRestartForMoreOutputs::OutputsUnmodifedDontNeed
bool anyHashMismatchSeen = false
bool anyCheckMismatchSeen = false
RetrySubstitution retrySubstitution = RetrySubstitution::NoNeed
std::unique_ptr< Derivationdrv
std::unique_ptr< ParsedDerivationparsedDrv
std::optional< PathLocks > outputLocks
StorePathSet inputPaths
std::map< std::string, InitialOutputinitialOutputs
BuildResult buildResult
AutoCloseFD fdLogFile
std::shared_ptr< BufferedSinklogFileSink
std::shared_ptr< BufferedSinklogSink
unsigned long logSize
std::list< std::string > logTail
std::string currentLogLine
size_t currentLogLinePos = 0
std::string currentHookLine
std::unique_ptr< HookInstancehook
AutoCloseFDbuilderOutFD = nullptr
std::optional< DerivationTypederivationType
BuildMode buildMode
NotifyingCounter< uint64_t >::Bump mcExpectedBuilds
NotifyingCounter< uint64_t >::Bump mcRunningBuilds
std::unique_ptr< Activityact
std::unique_ptr< ActivityactLock
std::map< ActivityId, ActivitybuilderActivities
std::string machineName
Public Attributes inherited from nix::Goal
Workerworker
const bool isDependency
size_t nrFailed = 0
size_t nrNoSubstituters = 0
size_t nrIncompleteClosure = 0
std::string name

Protected Member Functions

kj::Promise< Outcome< void, WorkResult > > handleChildOutput () noexcept
kj::Promise< Outcome< void, WorkResult > > handleChildStreams (InputStream &builderIn, InputStream *hookIn) noexcept
kj::Promise< Outcome< void, WorkResult > > handleBuilderOutput (InputStream &in) noexcept
kj::Promise< Outcome< void, WorkResult > > handleHookOutput (InputStream &in) noexcept
kj::Promise< Outcome< void, WorkResult > > monitorForSilence () noexcept
WorkResult tooMuchLogs ()
void flushLine ()
Protected Member Functions inherited from nix::Goal
kj::Promise< void > waitForAWhile ()
kj::Promise< Result< void > > waitForGoals (kj::Array< std::pair< GoalPtr, kj::Promise< Result< WorkResult > > > > dependencies) noexcept
template<std::derived_from< Goal >... G>
kj::Promise< Result< void > > waitForGoals (std::pair< std::shared_ptr< G >, kj::Promise< Result< WorkResult > > >... goals) noexcept
std::string lixAsyncTaskContext () const

Protected Attributes

kj::TimePoint lastChildActivity = kj::minValue
Protected Attributes inherited from nix::Goal
AsyncSemaphore::Token slotToken

Detailed Description

A goal for building some or all of the outputs of a derivation.

Member Enumeration Documentation

◆ NeedRestartForMoreOutputs

See needRestart; just for that field.

Enumerator
OutputsAddedDoNeed 

The goal state machine is progressing based on the current value of wantedOutputs. No actions are needed. */ OutputsUnmodifedDontNeed, /** wantedOutputs` has been extended, but the state machine is proceeding according to its old value, so we need to restart.

BuildInProgressWillNotNeed 

The goal state machine has progressed to the point of doing a build, in which case all outputs will be produced, so extensions to wantedOutputs no longer require a restart.

◆ RetrySubstitution

See retrySubstitution; just for that field.

Enumerator
NoNeed 

No issues have yet arose, no need to restart.

YesNeed 

Something failed and there is an incomplete closure. Let's retry substituting.

AlreadyRetried 

We are current or have already retried substitution, and whether or not something goes wrong we will not retry again.

Member Function Documentation

◆ addWantedOutputs()

bool nix::DerivationGoal::addWantedOutputs ( const OutputsSpec & outputs)

Add wanted outputs to an already existing derivation goal.

◆ assertPathValidity()

kj::Promise< Result< SingleDrvOutputs > > nix::DerivationGoal::assertPathValidity ( )

Aborts if any output is not valid or corrupt, and otherwise returns a 'SingleDrvOutputs' structure containing all outputs.

◆ checkPathValidity()

kj::Promise< Result< std::pair< bool, SingleDrvOutputs > > > nix::DerivationGoal::checkPathValidity ( )

Update 'initialOutputs' to determine the current status of the outputs of the derivation. Also returns a Boolean denoting whether all outputs are valid and non-corrupt, and a 'SingleDrvOutputs' structure containing the valid outputs.

◆ cleanupHookFinally()

void nix::DerivationGoal::cleanupHookFinally ( )
virtual

Cleanup hooks for buildDone()

Reimplemented in nix::LocalDerivationGoal.

◆ closeLogFile()

void nix::DerivationGoal::closeLogFile ( )

Close the log file.

◆ closeReadPipes()

void nix::DerivationGoal::closeReadPipes ( )
virtual

Close the read side of the logger pipe.

Reimplemented in nix::LocalDerivationGoal.

◆ getDerivation()

kj::Promise< Result< Goal::WorkResult > > nix::DerivationGoal::getDerivation ( )
noexcept

The states.

◆ jobCategory()

JobCategory nix::DerivationGoal::jobCategory ( ) const
inlineoverridevirtual

Hint for the scheduler, which concurrency limit applies.

See also
JobCategory

Implements nix::Goal.

◆ killChild()

void nix::DerivationGoal::killChild ( )
virtual

Forcibly kill the child process, if any.

Reimplemented in nix::LocalDerivationGoal.

◆ openLogFile()

Path nix::DerivationGoal::openLogFile ( )

Open a log file and a pipe to it.

◆ queryPartialDerivationOutputMap()

kj::Promise< Result< std::map< std::string, std::optional< StorePath > > > > nix::DerivationGoal::queryPartialDerivationOutputMap ( )

Wrappers around the corresponding Store methods that first consult the derivation. This is currently needed because when there is no drv file there also is no DB entry.

◆ registerOutputs()

kj::Promise< Result< SingleDrvOutputs > > nix::DerivationGoal::registerOutputs ( )
virtual

Check that the derivation outputs all exist and register them as valid.

Reimplemented in nix::LocalDerivationGoal.

◆ signRealisation()

virtual void nix::DerivationGoal::signRealisation ( Realisation & )
inlinevirtual

Sign the newly built realisation if the store allows it

Reimplemented in nix::LocalDerivationGoal.

◆ tryBuildHook()

HookReply nix::DerivationGoal::tryBuildHook ( )

Is the build hook willing to perform the build?

◆ tryLocalBuild()

kj::Promise< Result< Goal::WorkResult > > nix::DerivationGoal::tryLocalBuild ( )
virtualnoexcept

Reimplemented in nix::LocalDerivationGoal.

◆ waiteeDone()

void nix::DerivationGoal::waiteeDone ( GoalPtr waitee)
overridevirtual

Reimplemented from nix::Goal.

◆ workImpl()

kj::Promise< Result< Goal::WorkResult > > nix::DerivationGoal::workImpl ( )
overridevirtualnoexcept

Implements nix::Goal.

Member Data Documentation

◆ actLock

std::unique_ptr<Activity> nix::DerivationGoal::actLock

Activity that denotes waiting for a lock.

◆ builderOutFD

AutoCloseFD* nix::DerivationGoal::builderOutFD = nullptr

Builder output is pulled from this file descriptor when not null. Owned by the derivation goal or subclass, must not be reset until the build has finished and no more output must be processed by us

◆ buildResult

BuildResult nix::DerivationGoal::buildResult

Build result.

◆ derivationType

std::optional<DerivationType> nix::DerivationGoal::derivationType

The sort of derivation we are building.

◆ drv

std::unique_ptr<Derivation> nix::DerivationGoal::drv

The derivation stored at drvPath.

◆ drvPath

StorePath nix::DerivationGoal::drvPath

The path of the derivation.

◆ fdLogFile

AutoCloseFD nix::DerivationGoal::fdLogFile

File descriptor for the log file.

◆ hook

std::unique_ptr<HookInstance> nix::DerivationGoal::hook

The build hook.

◆ inputDrvOutputs

std::map<std::pair<StorePath, std::string>, StorePath> nix::DerivationGoal::inputDrvOutputs

Mapping from input derivations + output names to actual store paths. This is filled in by waiteeDone() as each dependency finishes, before inputsRealised() is reached.

◆ inputPaths

StorePathSet nix::DerivationGoal::inputPaths

All input paths (that is, the union of FS closures of the immediate input paths).

◆ isDone

bool nix::DerivationGoal::isDone = false

Whether this goal has completed. Completed goals can not be asked for more outputs, a new goal must be created instead.

◆ logSize

unsigned long nix::DerivationGoal::logSize

Number of bytes received from the builder's stdout/stderr.

◆ logTail

std::list<std::string> nix::DerivationGoal::logTail

The most recent log lines.

◆ machineName

std::string nix::DerivationGoal::machineName

The remote machine on which we're building.

◆ needRestart

NeedRestartForMoreOutputs nix::DerivationGoal::needRestart = NeedRestartForMoreOutputs::OutputsUnmodifedDontNeed

Whether additional wanted outputs have been added.

◆ outputLocks

std::optional<PathLocks> nix::DerivationGoal::outputLocks

The remainder is state held during the build. Locks on (fixed) output paths.

◆ resolvedDrvGoal

std::shared_ptr<DerivationGoal> nix::DerivationGoal::resolvedDrvGoal

The goal for the corresponding resolved derivation

◆ retrySubstitution

RetrySubstitution nix::DerivationGoal::retrySubstitution = RetrySubstitution::NoNeed

Whether to retry substituting the outputs after building the inputs. This is done in case of an incomplete closure.

◆ useDerivation

bool nix::DerivationGoal::useDerivation

Whether to use an on-disk .drv file.

◆ wantedOutputs

OutputsSpec nix::DerivationGoal::wantedOutputs

The specific outputs that we need to build.


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