Matt Sturgeon | In reply to @tumble1999:matrix.org Does custom type casting exist or is it just set to string with outPath attribute? Generally speaking, nix doesn't have type casting. For interpolating values into strings ("${expr}" syntax), different types follow different rules:
- String values are interpolated as-is
- Path values are copied-to-store, and the resulting store path is interpolated (with context)
- Attrsets with a
__toString function call that function and interpolate the result
- Attrsets with an
outPath attribute interpolate that string.
- Other types typically raise an error
Examples in the wild: nixos options have a __toString function, which uses lib.showOption opt.loc internally; deprivations have an outPath, which is the store path the derivation will be installed to, once built. | 20:23:54 |