about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-09-03 21:16:29 +0200
committerSilvan Mosberger <contact@infinisil.com>2020-09-03 21:16:29 +0200
commitea5ba6e13d8b359059245668b69fe72e6d2a6211 (patch)
tree214e4a54b8aa70eaa5a50dbc4a376e236112db28
parentc54a127b62d8fd67cc9655f79552855d961b0cfb (diff)
lib/types: Show sub options of freeform types
Previously if you set the freeform type to e.g. attrsOf (submodule ..),
those submodule options wouldn't be shown in the manual.
-rw-r--r--lib/types.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 1845b6ae339e8..cc125c20311de 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -522,7 +522,12 @@ rec {
             # would be used, and use of `<` and `>` would break the XML document.
             # It shouldn't cause an issue since this is cosmetic for the manual.
             args.name = "‹name›";
-          }).options;
+          }).options // optionalAttrs (freeformType != null) {
+            # Expose the sub options of the freeform type. Note that the option
+            # discovery doesn't care about the attribute name used here, so this
+            # is just to avoid conflicts with potential options from the submodule
+            _freeformOptions = freeformType.getSubOptions prefix;
+          };
         getSubModules = modules;
         substSubModules = m: submoduleWith (attrs // {
           modules = m;