Skip to main content

Module value

Module value 

Source
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§

BuiltinFn
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 SmolStr is a string type that has the following properties:
StringContext
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.
ContextElement
An element of a Nix string’s context set.
EvalError
Evaluation errors produced by the Nix evaluator.
ThunkRepr
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.
in_promise_eval
true if the evaluator is currently inside the body of a ThunkRepr::Promise (used by eval_select to relax AttrNotFound errors 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 Symbol by (source_id, text_offset), computing it lazily via cold only on a cache miss.
next_source_id
Allocate a new source ID for a freshly parsed AST tree.
promotion_occurred
true if 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 prefer resolve_rc or with_resolvedRc::clone is ~20x cheaper than String::from for 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§

AttrsMap
Compact attrset map — a real hashbrown (std) HashMap with FxBuildHasher.
BuiltinFunc
The function signature stored inside a BuiltinFn.
FxHashMap
Type alias for the persistent hash map used by NixAttrs and Env.