Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::Evaluator Class Reference
Inheritance diagram for nix::Evaluator:
nix::eval_cache::CachingEvaluator

Public Member Functions

 Evaluator (AsyncIoRoot &aio, const SearchPath &_searchPath, ref< Store > store, std::shared_ptr< Store > buildStore=nullptr, std::function< ReplExitStatus(EvalState &es, ValMap const &extraEnv)> debugRepl=nullptr)
 Evaluator (const Evaluator &)=delete
 Evaluator (Evaluator &&)=delete
Evaluator & operator= (const Evaluator &)=delete
Evaluator & operator= (Evaluator &&)=delete
ExprparseExprFromFile (const CheckedSourcePath &path)
ExprparseExprFromFile (const CheckedSourcePath &path, std::shared_ptr< StaticEnv > &staticEnv)
ExprparseExprFromString (std::string s, const SourcePath &basePath, std::shared_ptr< StaticEnv > &staticEnv, const FeatureSettings &xpSettings=featureSettings)
ExprparseExprFromString (std::string s, const SourcePath &basePath, const FeatureSettings &xpSettings=featureSettings)
std::variant< std::unique_ptr< Expr >, ExprReplBindingsparseReplInput (std::string s, const SourcePath &basePath, std::shared_ptr< StaticEnv > &staticEnv, const FeatureSettings &xpSettings=featureSettings)
ExprparseStdin ()
void evalLazily (Expr &e, Value &v)
BindingsBuilder buildBindings (size_t capacity)
void maybePrintStats ()
void printStatistics ()
bool fullGC ()
box_ptr< EvalState > begin (AsyncIoRoot &aio)

Public Attributes

SymbolTable symbols
PosTable positions
const StaticSymbols s
EvalMemory mem
EvalRuntimeCaches caches
EvalPaths paths
EvalBuiltins builtins
EvalStatistics stats
RepairFlag repair
const ref< Storestore
ref< StorebuildStore
std::unique_ptr< DebugStatedebug
EvalErrorContext errors

Friends

class EvalBuiltins
class EvalState

Member Function Documentation

◆ begin()

box_ptr< EvalState > nix::Evaluator::begin ( AsyncIoRoot & aio)

Create an EvalState in prepation to evaluate some amount of Nix code.

While preparation of evaluation can be done with Evaluator itself only, actually evaluating things requires an EvalState. This function creates an EvalState and returns it. At most one EvalState per Evaluator may be live at any given point, and references to this EvalState must not live anywhere except in the returned box, local variables, or arguments. Any reference held in an object type is illegal, be it in a lambda capture, a pointer member of an object, a hidden member such as arguments passed to functions by std::thread or std::async—all references held where they could be copied are moved from are disallowed. EvalState is thus a witness type that a given thread may evaluate nix code and must never be run inside kj::Promise context. This is due to a kj limitation, in which it is not possible to block on a promise while already running in a promise without doing this blocking on a different event loop/thread.

◆ evalLazily()

void nix::Evaluator::evalLazily ( Expr & e,
Value & v )

Creates a thunk that will evaluate the given expression when forced.

◆ fullGC()

bool nix::Evaluator::fullGC ( )

Perform a full memory garbage collection - not incremental.

Returns
true if Nix was built with GC and a GC was performed, false if not. The return value is currently not thread safe - just the return value.

◆ maybePrintStats()

void nix::Evaluator::maybePrintStats ( )

Print statistics, if enabled.

Performs a full memory GC before printing the statistics, so that the GC statistics are more accurate.

◆ parseExprFromFile()

Expr & nix::Evaluator::parseExprFromFile ( const CheckedSourcePath & path)

Parse a Nix expression from the specified file.

◆ parseExprFromString()

Expr & nix::Evaluator::parseExprFromString ( std::string s,
const SourcePath & basePath,
std::shared_ptr< StaticEnv > & staticEnv,
const FeatureSettings & xpSettings = featureSettings )

Parse a Nix expression from the specified string.

◆ printStatistics()

void nix::Evaluator::printStatistics ( )

Print statistics, unconditionally, cheaply, without performing a GC first.

Member Data Documentation

◆ buildStore

ref<Store> nix::Evaluator::buildStore

Store used to build stuff.

◆ repair

RepairFlag nix::Evaluator::repair

If set, force copying files to the Nix store even if they already exist there.

◆ store

const ref<Store> nix::Evaluator::store

Store used to materialise .drv files.


The documentation for this class was generated from the following files:
  • lix/libexpr/eval.hh
  • lix/libexpr/eval.cc