|
Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
|
Public Member Functions | |
| EvalState (const EvalState &)=delete | |
| EvalState (EvalState &&)=delete | |
| EvalState & | operator= (const EvalState &)=delete |
| EvalState & | operator= (EvalState &&)=delete |
| void | evalFile (const SourcePath &path, Value &v) |
| void | resetFileCache () |
| void | eval (Expr &e, Value &v) |
| bool | evalBool (Env &env, Expr &e) |
| void | evalAttrs (Env &env, Expr &e, Value &v) |
| void | evalList (Env &env, Expr &e, Value &v) |
| void | forceValue (Value &v, const PosIdx pos) |
| void | tryFixupBlackHolePos (Value &v, PosIdx pos) |
| void | forceValueDeep (Value &v) |
| NixInt | forceInt (Value &v, const PosIdx pos, std::string_view errorCtx) |
| NixFloat | forceFloat (Value &v, const PosIdx pos, std::string_view errorCtx) |
| bool | forceBool (Value &v, const PosIdx pos, std::string_view errorCtx) |
| void | forceAttrs (Value &v, const PosIdx pos, std::string_view errorCtx) |
| void | forceList (Value &v, const PosIdx pos, std::string_view errorCtx) |
| void | forceFunction (Value &v, const PosIdx pos, std::string_view errorCtx) |
| std::string_view | forceString (Value &v, const PosIdx pos, std::string_view errorCtx) |
| std::string_view | forceString (Value &v, NixStringContext &context, const PosIdx pos, std::string_view errorCtx) |
| std::string_view | forceStringNoCtx (Value &v, const PosIdx pos, std::string_view errorCtx) |
| StringMap | realiseContext (const NixStringContext &context) |
| bool | isDerivation (Value &v) |
| std::optional< std::string > | tryAttrsToString (const PosIdx pos, Value &v, NixStringContext &context, bool coerceMore=false, bool copyToStore=true) |
| BackedStringView | coerceToString (const PosIdx pos, Value &v, NixStringContext &context, std::string_view errorCtx, bool coerceMore=false, bool copyToStore=true, bool canonicalizePath=true) |
| SourcePath | coerceToPath (const PosIdx pos, Value &v, NixStringContext &context, std::string_view errorCtx) |
| StorePath | coerceToStorePath (const PosIdx pos, Value &v, NixStringContext &context, std::string_view errorCtx) |
| std::pair< SingleDerivedPath, std::string_view > | coerceToSingleDerivedPathUnchecked (const PosIdx pos, Value &v, std::string_view errorCtx) |
| SingleDerivedPath | coerceToSingleDerivedPath (const PosIdx pos, Value &v, std::string_view errorCtx) |
| bool | eqValues (Value &v1, Value &v2, const PosIdx pos, std::string_view errorCtx) |
| bool | isFunctor (Value &fun) |
| void | callFunction (Value &fun, size_t nrArgs, Value **args, Value &vRes, const PosIdx pos) |
| void | callFunction (Value &fun, Value &arg, Value &vRes, const PosIdx pos) |
| void | autoCallFunction (Bindings &args, Value &fun, Value &res, PosIdx pos) |
| void | mkPos (Value &v, PosIdx pos) |
| void | mkOutputString (Value &value, const SingleDerivedPath::Built &b, std::optional< StorePath > optStaticOutputPath, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings) |
| void | mkSingleDerivedPathString (const SingleDerivedPath &p, Value &v) |
| void | concatLists (Value &v, size_t nrLists, Value **lists, const PosIdx pos, std::string_view errorCtx) |
Public Attributes | |
| Evaluator & | ctx |
| AsyncIoRoot & | aio |
Friends | |
| class | Evaluator |
| struct | ExprVar |
| struct | ExprSet |
| struct | ExprLet |
Automatically call a function for which each argument has a default value or has a binding in the args map.
| SourcePath nix::EvalState::coerceToPath | ( | const PosIdx | pos, |
| Value & | v, | ||
| NixStringContext & | context, | ||
| std::string_view | errorCtx ) |
Path coercion.
Converts strings, paths and derivations to a path. The result is guaranteed to be a canonicalised, absolute path. Nothing is copied to the store.
| SingleDerivedPath nix::EvalState::coerceToSingleDerivedPath | ( | const PosIdx | pos, |
| Value & | v, | ||
| std::string_view | errorCtx ) |
Coerce to SingleDerivedPath.
Must be a string which is either a literal store path or a "placeholder (see DownstreamPlaceholder).
Even more importantly, the string context must be exactly one element, which is either a NixStringContextElem::Opaque or NixStringContextElem::Built. (NixStringContextEleme::DrvDeep is not permitted).
The string is parsed based on the context — the context is the source of truth, and ultimately tells us what we want, and then we ensure the string corresponds to it.
| std::pair< SingleDerivedPath, std::string_view > nix::EvalState::coerceToSingleDerivedPathUnchecked | ( | const PosIdx | pos, |
| Value & | v, | ||
| std::string_view | errorCtx ) |
Part of coerceToSingleDerivedPath() without any store IO which is exposed for unit testing only.
| StorePath nix::EvalState::coerceToStorePath | ( | const PosIdx | pos, |
| Value & | v, | ||
| NixStringContext & | context, | ||
| std::string_view | errorCtx ) |
Like coerceToPath, but the result must be a store path.
| BackedStringView nix::EvalState::coerceToString | ( | const PosIdx | pos, |
| Value & | v, | ||
| NixStringContext & | context, | ||
| std::string_view | errorCtx, | ||
| bool | coerceMore = false, | ||
| bool | copyToStore = true, | ||
| bool | canonicalizePath = true ) |
String coercion.
Converts strings, paths and derivations to a string. If coerceMore is set, also converts nulls, integers, booleans and lists to a string. If copyToStore is set, referenced paths are copied to the Nix store as a side effect.
| bool nix::EvalState::eqValues | ( | Value & | v1, |
| Value & | v2, | ||
| const PosIdx | pos, | ||
| std::string_view | errorCtx ) |
Do a deep equality test between two values. That is, list elements and attributes are compared recursively.
Evaluate an expression to normal form
| [out] | v | The resulting is stored here. |
Evaluation the expression, then verify that it has the expected type.
| void nix::EvalState::evalFile | ( | const SourcePath & | path, |
| Value & | v ) |
Evaluate an expression read from the given file to normal form.
| v | either lambda or primop |
Force v, and then verify that it has the expected type.
If v is a thunk, enter it and overwrite v with the result of the evaluation of the thunk. If v is a delayed function application, call the function and overwrite v with the result. Otherwise, this is a no-op.
| void nix::EvalState::forceValueDeep | ( | Value & | v | ) |
Force a value, then recursively force list elements and attributes.
| bool nix::EvalState::isDerivation | ( | Value & | v | ) |
| void nix::EvalState::mkOutputString | ( | Value & | value, |
| const SingleDerivedPath::Built & | b, | ||
| std::optional< StorePath > | optStaticOutputPath, | ||
| const ExperimentalFeatureSettings & | xpSettings = experimentalFeatureSettings ) |
Create a string representing a SingleDerivedPath::Built.
The string is the printed store path with a context containing a single NixStringContextElem::Built element of the drv path and output name.
| value | Value we are settings |
| b | the drv whose output we are making a string for, and the output |
| optStaticOutputPath | Optional output path for that string. Must be passed if and only if output store object is input-addressed or fixed output. Will be printed to form string if passed, otherwise a placeholder will be used (see DownstreamPlaceholder). |
| xpSettings | Stop-gap to avoid globals during unit tests. |
| void nix::EvalState::mkSingleDerivedPathString | ( | const SingleDerivedPath & | p, |
| Value & | v ) |
Create a string representing a SingleDerivedPath.
A combination of mkStorePathString and mkOutputString.
|
nodiscard |
Realise the given context, and return a mapping from the placeholders used to construct the associated value to their final store path