pub enum NixExpr {
Str(String),
Bool(bool),
Null,
Int(i64),
Raw(String),
List(Vec<NixExpr>),
AttrSet(Vec<AttrEntry>),
Lambda {
params: Vec<String>,
body: Box<NixExpr>,
},
}Expand description
A node in the Nix expression tree.
Variants§
Str(String)
"…" — string literal. The printer escapes ", \, ${,
and newlines as Nix requires.
Bool(bool)
true / false.
Null
null.
Int(i64)
123 — integer literal.
Raw(String)
A bare identifier or dotted reference, e.g. pkgs.iosevka or
pkgs.nerd-fonts.jetbrains-mono. The printer emits the string
verbatim — it’s the author’s responsibility to ensure it’s a
valid Nix identifier expression. (Used because typed nesting
of every pkgs.<attr>.<sub> would buy nothing.)
List(Vec<NixExpr>)
[ a b c … ] — list literal.
AttrSet(Vec<AttrEntry>)
{ key = value; … } — attribute set. Vec (not BTreeMap) so the
renderer’s iteration order is preserved end-to-end; in design
systems this matters for legibility of the rendered output.
Each entry is (key, value, optional inline_comment).
Lambda
{ <params> }: <body> — single-parameter-pattern lambda.
params is a list of parameter names; the printer emits
{ p1, p2, … }: body.