StaticKey (Static Attribute Key)
Definition
StaticKey VarName
Fields
| Field | Type | Description |
|---|---|---|
contents | VarName | The identifier name |
Description
StaticKey is used for bare identifier keys in attribute sets: keys that are valid Nix identifiers (alphanumeric + underscore, not starting with a digit). These are written without quotes.
{ foo = 1; bar = 2; } -- both are StaticKey
Nix Source ↔ AST
# Nix
{ foo = 1; }
# AST (key part)
{ "tag": "StaticKey", "contents": "foo" }
Rules
- Must be a valid Nix identifier:
[a-zA-Z_][a-zA-Z0-9_]* - Cannot start with a digit
- Cannot contain spaces or special characters (those require
DynamicKey)
Related
- DynamicKey: dynamic/computed keys
- VarName: underlying type
- NamedVar: uses
AttrPathofKeyName
Nix Library Access
syntax.mkStaticKey "foo"
syntax.mkStaticKey "my_var_123"