-
-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/options: introduce "prime" fn variants (alt API) #1603
Conversation
0b363ac
to
3a4701d
Compare
I don't think that a squash is necessary. I am fine with one commit per function.
Makes sense indeed. |
My opinion on this quite mixed. So, no strong reject from my side. I would be curious to see what @traxys thinks about that. |
In principal, I don't think we should be afraid of growing I think the helpers library becoming intimidating is best addressed via documentation, examples, and guides. In particular, it may be nice to have automated docs similar to the Nixpkgs Manual, Noogle, etc. That said, if there are specific functions that are so simple and/or "single use" that it makes no sense to have a prime variant, we can drop them on a case-by case basis while reviewing this PR (or even revert them after it's merged). |
Sure.
Definitely true.
I agree. Also, even though we export the helpers publicly, I don't think we should be too worried of breaking users' workflow when changing them. |
Yeah I don't really have a problem with a growing number of helpers, as long as we know which one to apply |
And add function documentation.
3a4701d
to
297aa6d
Compare
This PR adds new variants for all low-lever option factory funcs (
mkNullable
,mkNullOrOption
, etc), as well as a handful of higher-level factories (mkAttributeSet
,mkAttrsOf
, &mkListOf
).This is done so that we have easy access to the underlying
lib.mkOption
attributes, such asexample
.All attributes are passed through blindly, unless they are intentionally modified along the way.
Currently this PR doesn't make any effort to document required arg-attributes.
I made (more or less) every function its own commit because I needed to use
git bisect
.This will also make it easier to drop/revert any specific function if we decide it's overkill to have a prime variant of it.
I'll happily squash once we're ready to merge - how would you like the history structured?
Unrelated change: combined
mkDesc
andmkDefaultDesc
into a single function, sincemkDefaultDesc
was not really intended to be used directly. The same functionality can be achieved by passing an emptydescription
tomkDesc
.