Is your feature request related to a problem?
We tend to use attribute paths to refer to attributes, like packages.x86_64-linux.default, and we do so in the expression language, but also outside of it with an ad hoc syntax. Problems:
- The ad hoc attribute path syntax has not been formalized.
- It's unclear how a different tool should parse it.
- It's unclear how a different tool should generate it.
- It may be unclear whether it embeds verbatim into other syntaxes (e.g. can it contain a
%?). I assume all symbols are valid and escaping attribute paths in URLs etc should always be done.
- We don't have C++ functions for parsing or generating this format.
- It's undocumented and it doesn't have a name.
- It can't access list items
Proposed solution
Formalize "Nix Pointer", analogous to JSON pointer, but with a syntax that aligns with our conventions.
- no
/ but . for selection (breaking from JSON pointer and XPointer)
- Nix expression language-compatible quoting for attribute names
- Attribute-only Nix pointers are valid select-expressions when prefixed with the string
v.
Alternative solutions
Additional context
We may want to bring a syntax for list selection into the Nix expression language so that all Nix pointers are valid expressions when prefixed with v. or some similar rule.
Checklist
Add 👍 to issues you find important.
Is your feature request related to a problem?
We tend to use attribute paths to refer to attributes, like
packages.x86_64-linux.default, and we do so in the expression language, but also outside of it with an ad hoc syntax. Problems:%?). I assume all symbols are valid and escaping attribute paths in URLs etc should always be done.Proposed solution
Formalize "Nix Pointer", analogous to JSON pointer, but with a syntax that aligns with our conventions.
/but.for selection (breaking from JSON pointer and XPointer)v.Alternative solutions
Additional context
We may want to bring a syntax for list selection into the Nix expression language so that all Nix pointers are valid expressions when prefixed with
v.or some similar rule.Checklist
Add 👍 to issues you find important.