-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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: support alternative type names #300664
Comments
I believe diff --git a/nix/common.nix b/nix/common.nix
index 39b27d4..f7cbe83 100644
--- a/nix/common.nix
+++ b/nix/common.nix
@@ -75,7 +75,10 @@ rec {
mkSubmoduleOption =
options:
lib.mkOption {
- type = lib.types.nullOr (lib.types.submodule { inherit options; });
+ type = lib.types.nullOr (lib.types.submoduleWith {
+ description = "My type";
+ modules = [ { inherit options; } ];
+ });
default = null;
};
=> #### `workflows.<name>.on.branch_protection_rule`
**Type**:
```text
null or (My type)
``` |
@infinisil, indeed, thank you! For some reason, in the original issue, I provided the context for another question. How do I override the |
Ah looks like #295872 then, to which I just replied with a suggestion :) |
Would
and whichever classes may exist in the wild. |
@roberth, I think my issue is resolved for now. Please reopen if you think it can be worked on. |
Describe the bug
I can't set descriptive names for
submodule
-s and see these names in docs.Steps To Reproduce
Build docs
Open
result.md
See there
null or (submodule)
See there
workflows.<name>
Expected behavior
I can set a descriptive type name and path segment name in the code and get that name in the docs.
Additional context
Currently, in
submoduleWith
, aname
isn't a parameter (link) and it's used in a couple of places (1, 2, 3).The
submoduleWith
is used inside the definition ofsubmoduleWith
(1, 2). Hence, it's hard to correctly overridename
in all places.The
"submoduleWith"
string occurs in erros insidesubmoduleWith
(link).Additionally, I see the "submodule" string is used:
in
modules.nix
nixpkgs/lib/modules.nix
Line 650 in af105fd
in a
nixos-option.cc
nixpkgs/pkgs/tools/nix/nixos-option/nixos-option.cc
Line 274 in af105fd
Possible solution
stableName
attribute to option types.stableName
is a stable type name.name
is a pretty type name.name
should default tostableName
.Notify maintainers
@infinisil
@roberth
Metadata
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: