AttrPath
Definition
NonEmpty KeyName
Description
AttrPath represents a path to an attribute in an attribute set, like foo.bar.baz. An attribute path must be non-empty: it always contains at least one key.
Nix Source ↔ AST
{
"tag": "NamedVar",
"attrPath": [
{ "tag": "StaticKey", "contents": "foo" },
{ "tag": "StaticKey", "contents": "bar" }
],
"value": { ... }
}
Examples
foo.bar.baz
→ [ StaticKey "foo", StaticKey "bar", StaticKey "baz" ]
"${name}.static"
→ [ DynamicKey (Antiquoted (Sym "name")), StaticKey "static" ]
Used as the attrPath field of:
NamedVar: binding left-hand sideSelect: attribute selectionHasAttr: attribute existence check
Related
Nix Library Access
syntax.mkStaticKey "foo"
syntax.mkDynamicKey (syntax.mkAntiquoted (syntax.mkSym "name"))