Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::DerivationGoal Struct Reference

#include <derivation-goal.hh>

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

Public Member Functions

 DerivationGoal (const StorePath &drvPath, ref< const Derivation > drv, const OutputName &wantedOutput, Worker &worker, BuildMode buildMode, bool storeDerivation)
std::string key () override
JobCategory jobCategory () const override
 Hint for the scheduler, which concurrency limit applies.
Public Member Functions inherited from nix::Goal
virtual void cleanup ()
 Goal (Worker &worker, Co< ExitCode > init)
void work ()
void handleChildOutput (Descriptor fd, std::string_view data)
void handleEOF (Descriptor fd)
void timedOut (TimedOut &&ex)
void trace (std::string_view s)
std::string getName () const
std::string_view keyCached () &

Public Attributes

StorePath drvPath
OutputName wantedOutput
Public Attributes inherited from nix::Goal
Worker & worker
WeakGoals waiters
size_t nrFailed = 0
size_t nrNoSubstituters = 0
std::string name
std::optional< ExitCode > exitCode
BuildResult buildResult
bool preserveFailure = false

Additional Inherited Members

Public Types inherited from nix::Goal
enum  ExitCode { ecSuccess , ecFailed , ecNoSubstituters }
using ChildEvent = std::variant<ChildOutput, ChildEOF, std::unique_ptr<TimedOut>>
template<typename T>
using HandleType = std::coroutine_handle<AwaitableFrame<T>>
using HandleTypeBase = std::coroutine_handle<AwaitableFrameBase>
Protected Member Functions inherited from nix::Goal
Co< void > await (Goals waitees)
Co< void > waitForAWhile ()
Co< void > waitUntilWoken ()
Co< void > waitForBuildSlot ()
Co< void > yield ()
Protected Attributes inherited from nix::Goal
std::optional< CoBase > top_co
std::optional< ExitCode > finalExitCode

Detailed Description

A goal for realising a single output of a derivation. Various sorts of fetching (which will be done by other goal types) is tried, and if none of those succeed, the derivation is attempted to be built.

This is a purely "administrative" goal type, which doesn't do any "real work" of substituting (that would be PathSubstitutionGoal or DrvOutputSubstitutionGoal) or building (that would be a DerivationBuildingGoal). This goal type creates those types of goals to attempt each way of realisation a derivation; they are tried sequentially in order of preference.

The derivation must already be gotten (in memory, in C++, parsed) and passed to the caller. If the derivation itself needs to be gotten first, a DerivationTrampolineGoal goal must be used instead.

Constructor & Destructor Documentation

◆ DerivationGoal()

nix::DerivationGoal::DerivationGoal ( const StorePath & drvPath,
ref< const Derivation > drv,
const OutputName & wantedOutput,
Worker & worker,
BuildMode buildMode,
bool storeDerivation )
Parameters
storeDerivationSee DerivationBuildingGoal. This is just passed along.

Member Function Documentation

◆ jobCategory()

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

Hint for the scheduler, which concurrency limit applies.

See also
JobCategory

Implements nix::Goal.

◆ key()

std::string nix::DerivationGoal::key ( )
overridevirtual

Used for comparisons. The order matters a bit for scheduling. We want:

  1. Substitution
  2. Derivation administrativia
  3. Actual building

Also, ensure that derivations get processed in order of their name, i.e. a derivation named "aardvark" always comes before "baboon".

Implements nix::Goal.

Member Data Documentation

◆ drvPath

StorePath nix::DerivationGoal::drvPath

The path of the derivation.

◆ wantedOutput

OutputName nix::DerivationGoal::wantedOutput

The specific outputs that we need to build.


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