|
Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
|
Public Member Functions | |
| USING_VALUETYPE (integer_t) | |
| USING_VALUETYPE (floating_t) | |
| USING_VALUETYPE (boolean_t) | |
| USING_VALUETYPE (string_t) | |
| USING_VALUETYPE (path_t) | |
| USING_VALUETYPE (list_t) | |
| USING_VALUETYPE (attrs_t) | |
| USING_VALUETYPE (thunk_t) | |
| USING_VALUETYPE (primop_t) | |
| USING_VALUETYPE (app_t) | |
| USING_VALUETYPE (null_t) | |
| USING_VALUETYPE (primOpApp_t) | |
| USING_VALUETYPE (lambda_t) | |
| USING_VALUETYPE (external_t) | |
| USING_VALUETYPE (blackhole_t) | |
| Value () | |
| Value (integer_t, NixInt i) | |
| Value (floating_t, NixFloat f) | |
| Value (boolean_t, bool b) | |
| Value (string_t, char const *strPtr, char const **contextPtr=nullptr) | |
| Value (string_t, std::string_view copyFrom, NixStringContext const &context={}) | |
| Value (string_t, char const *strPtr, NixStringContext const &context) | |
| Value (path_t, char const *strPtr) | |
| Value (path_t, SourcePath const &path) | |
| Value (list_t, std::span< Value * > items) | |
| template<std::ranges::sized_range SizedIterableT, InvocableR< Value *, typename SizedIterableT::value_type const & > TransformerT> | |
| Value (list_t, SizedIterableT &items, TransformerT const &transformer) | |
| Value (null_t) | |
| Constructs a nix language value of the singleton type "null". | |
| Value (attrs_t, Bindings *bindings) | |
| Value (thunk_t, Env &env, Expr &expr) | |
| Value (primop_t, PrimOp &primop) | |
| Value (primOpApp_t, Value &lhs, Value &rhs) | |
| Value (app_t, Value &lhs, Value &rhs) | |
| Value (external_t, ExternalValueBase &external) | |
| Value (lambda_t, Env &env, ExprLambda &lambda) | |
| Value (blackhole_t) | |
| Constructs an evil thunk, whose evaluation represents infinite recursion. | |
| Value (Value const &rhs)=default | |
| Value (Value &&rhs) | |
| Value & | operator= (Value const &rhs)=default |
| Value & | operator= (Value &&rhs) |
| void | print (EvalState &state, std::ostream &str, PrintOptions options=PrintOptions {}) |
| bool | isThunk () const |
| bool | isApp () const |
| bool | isBlackhole () const |
| bool | isLambda () const |
| bool | isPrimOp () const |
| bool | isPrimOpApp () const |
| ValueType | type (bool invalidIsThunk=false) const |
| void | clearValue () |
| void | mkInt (NixInt::Inner n) |
| void | mkInt (NixInt n) |
| void | mkBool (bool b) |
| void | mkString (const char *s, const char **context=0) |
| void | mkString (std::string_view s) |
| void | mkString (std::string_view s, const NixStringContext &context) |
| void | mkStringMove (const char *s, const NixStringContext &context) |
| void | mkPath (const SourcePath &path) |
| void | mkPath (const char *path) |
| void | mkNull () |
| void | mkAttrs (Bindings *a) |
| Value & | mkAttrs (BindingsBuilder &bindings) |
| void | mkList (size_t size) |
| void | mkThunk (Env *e, Expr &ex) |
| void | mkApp (Value *l, Value *r) |
| void | mkLambda (Env *e, ExprLambda *f) |
| void | mkBlackhole () |
| void | mkPrimOp (PrimOp *p) |
| void | mkPrimOpApp (Value *l, Value *r) |
| PrimOp * | primOpAppPrimOp () const |
| void | mkExternal (ExternalValueBase *e) |
| void | mkFloat (NixFloat n) |
| bool | isList () const |
| Value ** | listElems () |
| Value *const * | listElems () const |
| size_t | listSize () const |
| bool | isTrivial () const |
| auto | listItems () |
| auto | listItems () const |
| SourcePath | path () const |
| std::string_view | str () const |
Public Attributes | |
| union { | |
| uintptr_t _empty [2] | |
| NixInt integer | |
| struct { | |
| bool boolean | |
| uintptr_t _bool_pad | |
| } | |
| struct { | |
| const char * s | |
| const char ** context | |
| } string | |
| struct { | |
| const char * _path | |
| uintptr_t _path_pad | |
| } | |
| struct { | |
| Bindings * attrs | |
| uintptr_t _attrs_pad | |
| } | |
| struct { | |
| size_t size | |
| Value ** elems | |
| } bigList | |
| Value * smallList [2] | |
| struct { | |
| Env * env | |
| Expr * expr | |
| } thunk | |
| struct { | |
| Value * left | |
| Value * right | |
| } app | |
| struct { | |
| Env * env | |
| ExprLambda * fun | |
| } lambda | |
| struct { | |
| PrimOp * primOp | |
| uintptr_t _primop_pad | |
| } | |
| struct { | |
| Value * left | |
| Value * right | |
| } primOpApp | |
| struct { | |
| ExternalValueBase * external | |
| uintptr_t _external_pad | |
| } | |
| struct { | |
| NixFloat fpoint | |
| uintptr_t _float_pad | |
| } | |
| }; | |
Static Public Attributes | |
| static Value | EMPTY_LIST {Value::list_t{}, {}} |
Friends | |
| std::string | showType (const Value &v) |
|
inline |
Default constructor which is still used in the codebase but should not be used in new code. Zero initializes its members.
|
inline |
Constructs a nix language value of type "int", with the integral value of i.
|
inline |
Constructs a nix language value of type "float", with the floating point value of f.
|
inline |
Constructs a nix language value of type "bool", with the boolean value of b.
|
inline |
Constructs a nix language value of type "string", with the value of the C-string pointed to by strPtr, and optionally with an array of string context pointed to by contextPtr.
Neither the C-string nor the context array are copied; this constructor assumes suitable memory has already been allocated (with the GC if enabled), and string and context data copied into that memory.
|
inline |
Constructx a nix language value of type "string", with a copy of the string data viewed by copyFrom.
The string data is copied from copyFrom, and this constructor performs a dynamic (GC) allocation to do so.
|
inline |
Constructx a nix language value of type "string", with the value of the C-string pointed to by strPtr, and optionally with a set of string context context.
The C-string is not copied; this constructor assumes suitable memory has already been allocated (with the GC if enabled), and string data has been copied into that memory. The context data is copied from context, and this constructor performs a dynamic (GC) allocation to do so.
|
inline |
Constructs a nix language value of type "path", with the value of the C-string pointed to by strPtr.
The C-string is not copied; this constructor assumes suitable memory has already been allocated (with the GC if enabled), and string data has been copied into that memory.
|
inline |
Constructs a nix language value of type "path", with the path path.
The data from path is copied, and this constructor performs a dynamic (GC) allocation to do so.
|
inline |
Constructs a nix language value of type "list", with element array items.
Generally, the data in items is neither deep copied nor shallow copied. This construct assumes the std::span items is a region of memory that has already been allocated (with the GC if enabled), and an array of valid Value pointers has been copied into that memory.
Howver, as an implementation detail, if items is only 2 items or smaller, the list is stored inline, and the Value pointers in items are shallow copied into this structure, without dynamically allocating memory.
|
inline |
Constructs a nix language value of type "list", with an element array initialized by applying transformer to each element in items.
This allows "in-place" construction of a nix list when some logic is needed to get each Value pointer. This constructor dynamically (GC) allocates memory for the size of items, and the Value pointers returned by transformer are shallow copied into it.
|
inline |
Constructs a nix language value of type "set", with the attribute bindings pointed to by bindings.
The bindings are not not copied; this constructor assumes bindings has already been suitably allocated by something like nix::buildBindings.
Constructs a nix language lazy delayed computation, or "thunk".
The thunk stores the environment it will be computed in env, and the expression that will need to be evaluated expr.
| nix::Value::Value | ( | primop_t | , |
| PrimOp & | primop ) |
Constructs a nix language value of type "lambda", which represents a builtin, primitive operation ("primop"), from the primop implemented by primop.
|
inline |
Constructs a nix language value of type "lambda", which represents a partially applied primop.
|
inline |
Constructs a nix language value of type "lambda", which represents a lazy partial application of another lambda.
|
inline |
Constructs a nix language value of type "external", which is only used by plugins. Do any existing plugins even use this mechanism?
|
inline |
Constructs a nix language value of type "lambda", which represents a run of the mill lambda defined in nix code.
This takes the environment the lambda is closed over env, and the lambda expression itself lambda, which will not be evaluated until it is applied.
|
inline |
Move constructor. Does the same thing as the copy constructor, but also zeroes out the other Value.
|
inline |
After overwriting an app node, be sure to clear pointers in the Value to ensure that the target isn't kept alive unnecessarily.
| bool nix::Value::isTrivial | ( | ) | const |
Check whether forcing this value requires a trivial amount of computation. In particular, function applications are non-trivial.
Move assignment operator. Does the same thing as the copy assignment operator, but also zeroes out the rhs.
| PrimOp * nix::Value::primOpAppPrimOp | ( | ) | const |
For a tPrimOpApp value, get the original PrimOp value.
|
inline |
| uintptr_t nix::Value::_empty[2] |
Dummy field, which takes up as much space as the largest union variants to set the union's memory to zeroed memory.
|
static |
Empty list constant.
| struct { ... } nix::Value::string |
Strings in the evaluator carry a so-called context which is a list of strings representing store paths. This is to allow users to write things like
"--with-freetype2-library=" + freetype + "/lib"
where freetype is a derivation (or a source to be copied to the store). If we just concatenated the strings without keeping track of the referenced store paths, then if the string is used as a derivation attribute, the derivation will not have the correct dependencies in its inputDrvs and inputSrcs.
The semantics of the context is as follows: when a string with context C is used as a derivation attribute, then the derivations in C will be added to the inputDrvs of the derivation, and the other store paths in C will be added to the inputSrcs of the derivations.
For canonicity, the store paths should be in sorted order.