Skip to content

Examples in NixOS options manual do not escape attribute names #195562

@brendon-boldt

Description

@brendon-boldt

Problem

Attribute sets in the manual's examples do not properly escape keys when are, for example, paths. For the "Example" for an option, we see { /home/user = "foo"; } which is invalid Nix code instead of { "/home/user" = "foo"; } which is valid Nix code. This happens when the Nix options get builtins.toJSON run on them during the manual generation. In the wild, look at /mnt/btr_pool in the example of this option. Maybe the general opinion on this is, "obviously attrset keys can't be paths", but it tripped me up for a few minutes as a newcomer, and I think it could be a nice quality of life improvement.

Checklist

Proposal

Changing toJSON in Nix seems inappropriate, so maybe I could open a PR with a Nix function which escapes the problem attributes, but that might have performance issues. I am open to suggestions (or just marking it as "won't fix").

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS9.needs: documentationThis needs to be documented well.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions