Expand description
Nix value types, environments, thunks, and error types. Nix value types and environments.
The evaluator is single-threaded: Env and NixAttrs contain
Rc<UnsafeCell<ThunkRepr>> thunks. All shared pointers use Rc
(not Arc) because the values are never sent across threads.
Modules§
- census
- Env-gated LIVE-OBJECT CENSUS.
Structs§
- Builtin
Fn - A builtin function.
- Closure
- A closure — lambda + captured environment.
- Env
- Evaluation environment — flattened binding map with structural sharing.
- NixAttrs
- A Nix attribute set with lazy overlay support.
- NixList
- Census wrapper around a list’s backing
Vec<Value>. - NixString
- A Nix string value with associated context (store-path references).
- Rc
- A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference Counted’.
- SmolStr
- A
SmolStris a string type that has the following properties: - String
Context - The context attached to a Nix string: a set of store-path references that the string depends on. Plain string literals have an empty context.
- Thunk
- A lazy value with memoization and blackhole detection.
Enums§
- Concrete
- A demanded Nix value. Guaranteed NOT a Thunk at the TYPE level.
- Context
Element - An element of a Nix string’s context set.
- Eval
Error - Evaluation errors produced by the Nix evaluator.
- Thunk
Repr - Internal representation of a thunk’s state machine.
- Value
- A Nix value — potentially lazy (may be a Thunk).
Functions§
- clear_
ident_ cache - Clear the identifier symbol cache.
- concat_
lists - Concatenate two Nix lists:
left ++ right_elems. - eq_
operator - Nix
==/!=at the OPERATOR, which is not the same relation as the one used for nested comparisons. - in_
promise_ eval trueif the evaluator is currently inside the body of aThunkRepr::Promise(used byeval_selectto relaxAttrNotFounderrors during fix-point construction).- intern
- Intern a string key, returning a Symbol handle. Used for NixAttrs keys and Env binding names.
- intern_
cached - Intern a string with caching by source ID and AST text offset.
- intern_
cached_ with - Cache an interned
Symbolby(source_id, text_offset), computing it lazily viacoldonly on a cache miss. - next_
source_ id - Allocate a new source ID for a freshly parsed AST tree.
- promotion_
occurred trueif any overlay-fixpoint promotion has fired in this eval.- resolve
- Resolve a Symbol back to its string content. Allocates a fresh
String. For hot paths preferresolve_rcorwith_resolved—Rc::cloneis ~20x cheaper thanString::fromfor identifier- sized inputs. - resolve_
rc - Resolve a Symbol to a shared
Rc<str>. Zero-copy. - with_
resolved - Borrow the resolved string inside a closure without allocating.
Type Aliases§
- Attrs
Map - Compact attrset map — a real
hashbrown(std)HashMapwithFxBuildHasher. - Builtin
Func - The function signature stored inside a
BuiltinFn. - FxHash
Map - Type alias for the persistent hash map used by
NixAttrsandEnv.