-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Closed as not planned
Closed as not planned
Copy link
Labels
0.kind: bugSomething is brokenSomething is broken6.topic: module systemAbout "NixOS" module system internalsAbout "NixOS" module system internals
Description
Describe the bug
For context, moduleType and extendModules duplicate the configuration namespace, but with user-defined modules added.
Extending the configuration more than once makes name throw a duplicate definition error.
Steps To Reproduce
Suppose we have
{ config, moduleType, ... }: {
options.variants = mkOption { type = attrsOf moduleType; };
options.result = mkOption { type = str; };
}then
variants.foo = { name, ... }: { result = name; }
will result in
variants.foo.result == "foo"
but
variants.foo.variants.bar = { name, ... }: { result = name; }
causes an error because name is redefined in the second level.
Expected behavior
-
namedoes not throw an error. -
All names can be used.
Additional context
Discovered in #176557 matrix module.
This can be solved by defining name in specialArgs, or by making the parameter name configurable (creating PR in a minute).
Notify maintainers
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
0.kind: bugSomething is brokenSomething is broken6.topic: module systemAbout "NixOS" module system internalsAbout "NixOS" module system internals