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

lib/types: allow changing the name of name #218812

Closed
wants to merge 1 commit into from

Conversation

ncfavier
Copy link
Member

@ncfavier ncfavier commented Feb 28, 2023

Provides a way to fïx nix-community/home-manager#3716

Adds a new nameArgument argument to submoduleWith that allows changing which argument the "name" (last item of loc, i.e. attribute name or option name this submodule appears under) is bound to.

This avoids conflicts when moduleType is used inside a submodule, where name would be set to both the outer submodule's name and the inner one's. If the outer submodule type sets nameArgument to something different, moduleType will continue using name, avoiding the conflict.

Ideally, there should probably be a way to change the inner name too to remove all ambiguity.

Adds a new `nameArgument` argument to `submoduleWith` that allows
changing which argument the "name" (last item of `loc`, i.e. attribute
name or option name this submodule appears under) is bound to.

This avoids conflicts when `moduleType` is used inside a submodule,
where `name` would be set to both the outer submodule's name and the
inner one's. If the outer submodule type sets `nameArgument` to
something different, `moduleType` will continue using `name`, avoiding
the conflict.

Ideally, there should probably be a way to change the inner `name` too
to remove all ambiguity.
@roberth
Copy link
Member

roberth commented Feb 28, 2023

Duplicate of #177576, but can be considered again.
Please don't remove the PR template.

@ncfavier
Copy link
Member Author

ncfavier commented Feb 28, 2023

I thought this might have been a known issue, but couldn't find it. I certainly did not expect it to have been known for 9 years 😅.

Since much better solutions are being discussed (dependentAttrsOf, attrsWith) and the issue seems to have a workaround anyway, I think I'll close this.

@ncfavier ncfavier closed this Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants