Skip to content
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

attrsOf -> lazyAttrsOf #271

Merged
merged 1 commit into from
Mar 12, 2024
Merged

attrsOf -> lazyAttrsOf #271

merged 1 commit into from
Mar 12, 2024

Conversation

roberth
Copy link
Collaborator

@roberth roberth commented Mar 12, 2024

This means we don't support mkIf in the exact places where the type was attrsOf. Almost always, mkIf can be replaced by optionalAttrs.

The benefit is that the code becomes much lazier, improving performance and

This means we don't support `mkIf` in the exact places where the
type was `attrsOf`. Almost always, `mkIf` can be replaced by
`optionalAttrs`.

The benefit is that the code becomes much lazier, improving performance
and
- Fixes srid#270
@srid
Copy link
Owner

srid commented Mar 12, 2024

Thanks!

I guess I should just use lazyAttrsOf for everything by default? What's the point of keeping the strict version by default in nixpkgs (ie., why not types.strictAttrsOf)?

@roberth
Copy link
Collaborator Author

roberth commented Mar 12, 2024

In Nixpkgs, attrsOf is often "just data" which is consumed wholesale. There it might make sense to still use attrsOf and support mkIf, but I'm not completely convinced.
I think the rule "mkIf for submodules, optionalAttrs for attrsets" works at least as well as the status quo, but I haven't proven it, and everyone will need to be made aware of it, if Nixpkgs does switch.

@srid srid merged commit 73707ab into srid:master Mar 12, 2024
2 checks passed
@roberth
Copy link
Collaborator Author

roberth commented Mar 12, 2024

I've opened a Nixpkgs issue for this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

devShell to eagerly evaluated?
2 participants