-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Module system: add arbitrary labels to options (meta/labels?) #305741
Copy link
Copy link
Open
Labels
0.kind: enhancementAdd something new or improve an existing system.Add something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: module systemAbout "NixOS" module system internalsAbout "NixOS" module system internals
Metadata
Metadata
Assignees
Labels
0.kind: enhancementAdd something new or improve an existing system.Add something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: module systemAbout "NixOS" module system internalsAbout "NixOS" module system internals
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status
Project description
Option declarations are currently of a fairly closed form, as we can't add arbitrary metadata to them.
This could provide an avenue for both implementing features externally when they are not desirable or controversial in NixOS itself, e.g.
... and this could also allow currently "core" features such as
internalorvisibleto be moved out of the hot path, improving performance. Crucially, for the performance improvement to work,configmust never evaluateopt.meta, based solely on the module system itself. (Modules such asdocumentation.nixwill evaluate them, and that's ok.)Proposal:
metafield tomkOptionmetain the evaluatedoptionsmeta = throw "module evaluation must be lazy in meta";in a number of testsvisibleandinternal (and more?) intometa`mkOptionparameters write to bothmetaand the option attrsetmkOption, and warn when legacy option attrs are usedNote that after (2), applications can already start using this for their own purposes.
Example:
I've chosen
metain my examples, althoughmetain packages is closed, unlike this proposal which is open.That might be a reason to pick
labelsinstead? I'm undecided.I'd be happy to implement this without moving anything, but candidates for moving are:
descriptiondefaultTextexamplerelatedPackagesinternalvisibleAdd a 👍 reaction to issues you find important.