| For simple/flat options, all the definition listed in the option are the ones that "won" the priority.
Specifically, all of opt.definitions and opt.definitionsWithLocations have opt.highestPrio.
That's because most wrappers like mkIf, mkMerge, mkOverride, and mkOrder are resolved before creating the option's definitions list.
However, this is only done for the option's definitions (i.e. the top-level). Wrappers on nested attrs are applied by the option's type when it merges the option's definitions.
I don't know of an "easy" way to filter for definitions of a specific attr on an attrsOf type.
There are some functions like lib.modules.mergeAttrDefinitionsWithPrio, so maybe something similar exists or could be written that exposes definition location for attrsOf sub-attrs?
If you were dealing with a submodule, and had an explicit suboption declared, then you could access the suboption's definitions within the submodule eval. E.g., you could expose them to the wider module eval by defining an internal option in the submodule. |