Inherit { scope :: Maybe Expr, names :: [VarName] }
| Field | Type | Description |
scope | Maybe Expr | Optional scope expression (Nothing = current scope, Just e = inherit from e) |
names | [VarName] | List of variable names to inherit |
# Nix
inherit x y z;
# AST
{
"tag": "Inherit",
"scope": null,
"names": ["x", "y", "z"]
}
# Nix
inherit (pkgs) vim git;
# AST
{
"tag": "Inherit",
"scope": { "tag": "Sym", "contents": "pkgs" },
"names": ["vim", "git"]
}
- NamedVar: named variable binding
- Let: let expressions using bindings
- Set: attribute sets using bindings
syntax.mkInherit null ["x" "y" "z"]
syntax.mkInherit (syntax.mkSym "pkgs") ["vim" "git"]