diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
 # Changelog
 
+## [0.1.0.0] - 2026-11-14
+
+### Added
+
+* `goldenSettingsNixOptionTypeSpec`, `goldenParserNixOptionTypeSpec` and
+  `pureGoldenNixOptionType`.
+
+### Removed
+
+* `goldenSettingsNixOptionsSpec`, `goldenParserNixOptionsSpec` and
+  `pureGoldenNixOptions`.
+
 ## [0.0.0.5] - 2026-09-27
 
 ### Changed
diff --git a/opt-env-conf-test.cabal b/opt-env-conf-test.cabal
--- a/opt-env-conf-test.cabal
+++ b/opt-env-conf-test.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           opt-env-conf-test
-version:        0.0.0.5
+version:        0.1.0.0
 synopsis:       A testing companion package for opt-env-conf
 homepage:       https://github.com/NorfairKing/opt-env-conf#readme
 bug-reports:    https://github.com/NorfairKing/opt-env-conf/issues
@@ -27,7 +27,7 @@
     test_resources/docs/big-config/env.txt
     test_resources/docs/big-config/help.txt
     test_resources/docs/big-config/man.txt
-    test_resources/docs/big-config/nix-options.nix
+    test_resources/docs/big-config/nix-option-type.nix
     test_resources/docs/big-config/opt-docs.txt
     test_resources/docs/big-config/opt-long.txt
     test_resources/docs/big-config/opt-short.txt
@@ -41,7 +41,7 @@
     test_resources/docs/empty/env.txt
     test_resources/docs/empty/help.txt
     test_resources/docs/empty/man.txt
-    test_resources/docs/empty/nix-options.nix
+    test_resources/docs/empty/nix-option-type.nix
     test_resources/docs/empty/opt-docs.txt
     test_resources/docs/empty/opt-long.txt
     test_resources/docs/empty/opt-short.txt
@@ -55,7 +55,7 @@
     test_resources/docs/enable-disable-optional/env.txt
     test_resources/docs/enable-disable-optional/help.txt
     test_resources/docs/enable-disable-optional/man.txt
-    test_resources/docs/enable-disable-optional/nix-options.nix
+    test_resources/docs/enable-disable-optional/nix-option-type.nix
     test_resources/docs/enable-disable-optional/opt-docs.txt
     test_resources/docs/enable-disable-optional/opt-long.txt
     test_resources/docs/enable-disable-optional/opt-short.txt
@@ -69,7 +69,7 @@
     test_resources/docs/enable-disable/env.txt
     test_resources/docs/enable-disable/help.txt
     test_resources/docs/enable-disable/man.txt
-    test_resources/docs/enable-disable/nix-options.nix
+    test_resources/docs/enable-disable/nix-option-type.nix
     test_resources/docs/enable-disable/opt-docs.txt
     test_resources/docs/enable-disable/opt-long.txt
     test_resources/docs/enable-disable/opt-short.txt
@@ -83,7 +83,7 @@
     test_resources/docs/greet/env.txt
     test_resources/docs/greet/help.txt
     test_resources/docs/greet/man.txt
-    test_resources/docs/greet/nix-options.nix
+    test_resources/docs/greet/nix-option-type.nix
     test_resources/docs/greet/opt-docs.txt
     test_resources/docs/greet/opt-long.txt
     test_resources/docs/greet/opt-short.txt
@@ -97,7 +97,7 @@
     test_resources/docs/hidden/env.txt
     test_resources/docs/hidden/help.txt
     test_resources/docs/hidden/man.txt
-    test_resources/docs/hidden/nix-options.nix
+    test_resources/docs/hidden/nix-option-type.nix
     test_resources/docs/hidden/opt-docs.txt
     test_resources/docs/hidden/opt-long.txt
     test_resources/docs/hidden/opt-short.txt
@@ -111,7 +111,7 @@
     test_resources/docs/many-args/env.txt
     test_resources/docs/many-args/help.txt
     test_resources/docs/many-args/man.txt
-    test_resources/docs/many-args/nix-options.nix
+    test_resources/docs/many-args/nix-option-type.nix
     test_resources/docs/many-args/opt-docs.txt
     test_resources/docs/many-args/opt-long.txt
     test_resources/docs/many-args/opt-short.txt
@@ -125,7 +125,7 @@
     test_resources/docs/optional/env.txt
     test_resources/docs/optional/help.txt
     test_resources/docs/optional/man.txt
-    test_resources/docs/optional/nix-options.nix
+    test_resources/docs/optional/nix-option-type.nix
     test_resources/docs/optional/opt-docs.txt
     test_resources/docs/optional/opt-long.txt
     test_resources/docs/optional/opt-short.txt
@@ -139,7 +139,7 @@
     test_resources/docs/same-help/env.txt
     test_resources/docs/same-help/help.txt
     test_resources/docs/same-help/man.txt
-    test_resources/docs/same-help/nix-options.nix
+    test_resources/docs/same-help/nix-option-type.nix
     test_resources/docs/same-help/opt-docs.txt
     test_resources/docs/same-help/opt-long.txt
     test_resources/docs/same-help/opt-short.txt
@@ -153,7 +153,7 @@
     test_resources/docs/secret/env.txt
     test_resources/docs/secret/help.txt
     test_resources/docs/secret/man.txt
-    test_resources/docs/secret/nix-options.nix
+    test_resources/docs/secret/nix-option-type.nix
     test_resources/docs/secret/opt-docs.txt
     test_resources/docs/secret/opt-long.txt
     test_resources/docs/secret/opt-short.txt
@@ -167,7 +167,7 @@
     test_resources/docs/some-args/env.txt
     test_resources/docs/some-args/help.txt
     test_resources/docs/some-args/man.txt
-    test_resources/docs/some-args/nix-options.nix
+    test_resources/docs/some-args/nix-option-type.nix
     test_resources/docs/some-args/opt-docs.txt
     test_resources/docs/some-args/opt-long.txt
     test_resources/docs/some-args/opt-short.txt
@@ -181,7 +181,7 @@
     test_resources/docs/sub-commands/env.txt
     test_resources/docs/sub-commands/help.txt
     test_resources/docs/sub-commands/man.txt
-    test_resources/docs/sub-commands/nix-options.nix
+    test_resources/docs/sub-commands/nix-option-type.nix
     test_resources/docs/sub-commands/opt-docs.txt
     test_resources/docs/sub-commands/opt-long.txt
     test_resources/docs/sub-commands/opt-short.txt
@@ -195,7 +195,7 @@
     test_resources/docs/sub-settings/env.txt
     test_resources/docs/sub-settings/help.txt
     test_resources/docs/sub-settings/man.txt
-    test_resources/docs/sub-settings/nix-options.nix
+    test_resources/docs/sub-settings/nix-option-type.nix
     test_resources/docs/sub-settings/opt-docs.txt
     test_resources/docs/sub-settings/opt-long.txt
     test_resources/docs/sub-settings/opt-short.txt
@@ -209,7 +209,7 @@
     test_resources/docs/sum-type/env.txt
     test_resources/docs/sum-type/help.txt
     test_resources/docs/sum-type/man.txt
-    test_resources/docs/sum-type/nix-options.nix
+    test_resources/docs/sum-type/nix-option-type.nix
     test_resources/docs/sum-type/opt-docs.txt
     test_resources/docs/sum-type/opt-long.txt
     test_resources/docs/sum-type/opt-short.txt
@@ -223,7 +223,7 @@
     test_resources/docs/three-commands/env.txt
     test_resources/docs/three-commands/help.txt
     test_resources/docs/three-commands/man.txt
-    test_resources/docs/three-commands/nix-options.nix
+    test_resources/docs/three-commands/nix-option-type.nix
     test_resources/docs/three-commands/opt-docs.txt
     test_resources/docs/three-commands/opt-long.txt
     test_resources/docs/three-commands/opt-short.txt
@@ -237,7 +237,7 @@
     test_resources/docs/verbose/env.txt
     test_resources/docs/verbose/help.txt
     test_resources/docs/verbose/man.txt
-    test_resources/docs/verbose/nix-options.nix
+    test_resources/docs/verbose/nix-option-type.nix
     test_resources/docs/verbose/opt-docs.txt
     test_resources/docs/verbose/opt-long.txt
     test_resources/docs/verbose/opt-short.txt
@@ -251,7 +251,7 @@
     test_resources/docs/with-default/env.txt
     test_resources/docs/with-default/help.txt
     test_resources/docs/with-default/man.txt
-    test_resources/docs/with-default/nix-options.nix
+    test_resources/docs/with-default/nix-option-type.nix
     test_resources/docs/with-default/opt-docs.txt
     test_resources/docs/with-default/opt-long.txt
     test_resources/docs/with-default/opt-short.txt
@@ -265,7 +265,7 @@
     test_resources/docs/yes-no-optional/env.txt
     test_resources/docs/yes-no-optional/help.txt
     test_resources/docs/yes-no-optional/man.txt
-    test_resources/docs/yes-no-optional/nix-options.nix
+    test_resources/docs/yes-no-optional/nix-option-type.nix
     test_resources/docs/yes-no-optional/opt-docs.txt
     test_resources/docs/yes-no-optional/opt-long.txt
     test_resources/docs/yes-no-optional/opt-short.txt
@@ -279,7 +279,7 @@
     test_resources/docs/yes-no/env.txt
     test_resources/docs/yes-no/help.txt
     test_resources/docs/yes-no/man.txt
-    test_resources/docs/yes-no/nix-options.nix
+    test_resources/docs/yes-no/nix-option-type.nix
     test_resources/docs/yes-no/opt-docs.txt
     test_resources/docs/yes-no/opt-long.txt
     test_resources/docs/yes-no/opt-short.txt
@@ -346,6 +346,7 @@
     test_resources/lint/some-env.txt
     test_resources/lint/unknown-default-command.txt
     test_resources/lint/unreadable-example.txt
+    test_resources/nix-option-type-with-generated-comment.nix
 
 source-repository head
   type: git
@@ -366,7 +367,7 @@
     , base <5
     , genvalidity
     , genvalidity-containers
-    , opt-env-conf >=0.9.0.0
+    , opt-env-conf >=0.16.0.0
     , safe-coloured-text
     , sydtest
     , text
@@ -406,7 +407,7 @@
     , genvalidity-sydtest
     , genvalidity-text
     , mtl
-    , opt-env-conf >=0.15.0.3
+    , opt-env-conf >=0.16.0.0
     , opt-env-conf-test
     , path
     , path-io
diff --git a/src/OptEnvConf/Test.hs b/src/OptEnvConf/Test.hs
--- a/src/OptEnvConf/Test.hs
+++ b/src/OptEnvConf/Test.hs
@@ -30,9 +30,9 @@
     pureGoldenReferenceDocumentation,
 
     -- * Nix options
-    goldenSettingsNixOptionsSpec,
-    goldenParserNixOptionsSpec,
-    pureGoldenNixOptions,
+    goldenSettingsNixOptionTypeSpec,
+    goldenParserNixOptionTypeSpec,
+    pureGoldenNixOptionType,
     module OptEnvConf,
   )
 where
@@ -131,18 +131,18 @@
       renderReferenceDocumentation progname $
         parserDocs parser
 
-goldenSettingsNixOptionsSpec :: forall a. (HasCallStack) => (HasParser a) => FilePath -> Spec
-goldenSettingsNixOptionsSpec path = withFrozenCallStack $ goldenParserNixOptionsSpec (settingsParser @a) path
+goldenSettingsNixOptionTypeSpec :: forall a. (HasCallStack) => (HasParser a) => FilePath -> Spec
+goldenSettingsNixOptionTypeSpec path = withFrozenCallStack $ goldenParserNixOptionTypeSpec (settingsParser @a) path
 
-goldenParserNixOptionsSpec :: (HasCallStack) => Parser a -> FilePath -> Spec
-goldenParserNixOptionsSpec parser path = withFrozenCallStack $ do
-  specify "produces the nix options as before" $
-    pureGoldenNixOptions path parser
+goldenParserNixOptionTypeSpec :: (HasCallStack) => Parser a -> FilePath -> Spec
+goldenParserNixOptionTypeSpec parser path = withFrozenCallStack $ do
+  specify "produces the nix option type as before" $
+    pureGoldenNixOptionType path parser
 
-pureGoldenNixOptions :: (HasCallStack) => FilePath -> Parser a -> GoldenTest Text
-pureGoldenNixOptions path parser =
+pureGoldenNixOptionType :: (HasCallStack) => FilePath -> Parser a -> GoldenTest Text
+pureGoldenNixOptionType path parser =
   pureGoldenTextFile path $
-    generatedFileComment Stack.callStack <> renderParserNixOptions parser
+    generatedFileComment Stack.callStack <> renderParserNixOptionType parser
 
 generatedFileComment :: CallStack -> T.Text
 generatedFileComment cs =
diff --git a/test/OptEnvConf/APISpec.hs b/test/OptEnvConf/APISpec.hs
--- a/test/OptEnvConf/APISpec.hs
+++ b/test/OptEnvConf/APISpec.hs
@@ -38,6 +38,11 @@
   exampleParserSpec "three-commands" "example with three commands" threeCommandsParser
   exampleParserSpec "sub-commands" "example with subcommands" subCommandsParser
 
+  describe "renderParserNixOptionTypeWithGeneratedComment" $
+    it "renders the type below a comment that says how it was generated" $
+      pureGoldenTextFile "test_resources/nix-option-type-with-generated-comment.nix" $
+        renderParserNixOptionTypeWithGeneratedComment "sub-settings" subSettingsParser
+
 exampleParserSpec :: (HasCallStack) => FilePath -> String -> Parser a -> Spec
 exampleParserSpec dir progDesc p = withFrozenCallStack $ describe dir $ do
   let version = makeVersion [0, 0, 0]
@@ -111,8 +116,8 @@
       renderReferenceDocumentation dir $
         parserDocs p
 
-  it "renders the Nix options the same way" $
-    pureGoldenNixOptions ("test_resources/docs/" <> dir <> "/nix-options.nix") p
+  it "renders the Nix option type the same way" $
+    pureGoldenNixOptionType ("test_resources/docs/" <> dir <> "/nix-option-type.nix") p
 
 sameHelpParser :: Parser (Either Int String, Bool)
 sameHelpParser =
diff --git a/test_resources/docs/big-config/nix-option-type.nix b/test_resources/docs/big-config/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/big-config/nix-option-type.nix
@@ -0,0 +1,51 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:25
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  big = lib.mkOption {
+    description = "big configuration object";
+    type = lib.types.nullOr (definedSubmodule ["map"] {
+      map = lib.mkOption {
+        defaultText = lib.literalMD "None, required" // {
+          required = true;
+        };
+        type = lib.types.attrsOf (lib.types.attrsOf lib.types.int);
+      };
+      sub = lib.mkOption {
+        defaultText = lib.literalMD "Unspecified";
+        type = lib.types.str;
+      };
+    });
+  };
+}
diff --git a/test_resources/docs/big-config/nix-options.nix b/test_resources/docs/big-config/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/big-config/nix-options.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:25
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  big = lib.mkOption {
-    default = null;
-    description = "big configuration object";
-    type = lib.types.nullOr (lib.types.submodule {
-      options = {
-        map = lib.mkOption {
-          type = lib.types.attrsOf (lib.types.attrsOf lib.types.int);
-        };
-        sub = lib.mkOption {
-          default = null;
-          type = lib.types.nullOr lib.types.str;
-        };
-      };
-    });
-  };
-}
diff --git a/test_resources/docs/empty/nix-option-type.nix b/test_resources/docs/empty/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/empty/nix-option-type.nix
@@ -0,0 +1,35 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:21
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] { }
diff --git a/test_resources/docs/empty/nix-options.nix b/test_resources/docs/empty/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/empty/nix-options.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:21
-# To update this it, run the test with --golden-reset
-{ lib }:
-{ }
diff --git a/test_resources/docs/enable-disable-optional/nix-option-type.nix b/test_resources/docs/enable-disable-optional/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/enable-disable-optional/nix-option-type.nix
@@ -0,0 +1,41 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:30
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  example = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "Example of an enable/disable switch";
+    type = lib.types.nullOr lib.types.bool;
+  };
+}
diff --git a/test_resources/docs/enable-disable-optional/nix-options.nix b/test_resources/docs/enable-disable-optional/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/enable-disable-optional/nix-options.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:30
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  example = lib.mkOption {
-    default = null;
-    description = "Example of an enable/disable switch";
-    type = lib.types.nullOr lib.types.bool;
-  };
-}
diff --git a/test_resources/docs/enable-disable/nix-option-type.nix b/test_resources/docs/enable-disable/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/enable-disable/nix-option-type.nix
@@ -0,0 +1,41 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:28
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  example = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "Example of an enable/disable switch";
+    type = lib.types.nullOr lib.types.bool;
+  };
+}
diff --git a/test_resources/docs/enable-disable/nix-options.nix b/test_resources/docs/enable-disable/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/enable-disable/nix-options.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:28
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  example = lib.mkOption {
-    default = null;
-    description = "Example of an enable/disable switch";
-    type = lib.types.nullOr lib.types.bool;
-  };
-}
diff --git a/test_resources/docs/greet/nix-option-type.nix b/test_resources/docs/greet/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/greet/nix-option-type.nix
@@ -0,0 +1,46 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:37
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  greeting = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified, interpreted as `\"Hello\"`";
+    description = "Greeting to use";
+    type = lib.types.nullOr lib.types.str;
+  };
+  polite = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "Whether to be polite";
+    type = lib.types.nullOr lib.types.bool;
+  };
+}
diff --git a/test_resources/docs/greet/nix-options.nix b/test_resources/docs/greet/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/greet/nix-options.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:37
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  greeting = lib.mkOption {
-    default = null;
-    description = "Greeting to use";
-    type = lib.types.nullOr lib.types.str;
-  };
-  polite = lib.mkOption {
-    default = null;
-    description = "Whether to be polite";
-    type = lib.types.nullOr lib.types.bool;
-  };
-}
diff --git a/test_resources/docs/hidden/nix-option-type.nix b/test_resources/docs/hidden/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/hidden/nix-option-type.nix
@@ -0,0 +1,35 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:27
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] { }
diff --git a/test_resources/docs/hidden/nix-options.nix b/test_resources/docs/hidden/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/hidden/nix-options.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:27
-# To update this it, run the test with --golden-reset
-{ lib }:
-{ }
diff --git a/test_resources/docs/many-args/nix-option-type.nix b/test_resources/docs/many-args/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/many-args/nix-option-type.nix
@@ -0,0 +1,35 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:22
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] { }
diff --git a/test_resources/docs/many-args/nix-options.nix b/test_resources/docs/many-args/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/many-args/nix-options.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:22
-# To update this it, run the test with --golden-reset
-{ lib }:
-{ }
diff --git a/test_resources/docs/optional/nix-option-type.nix b/test_resources/docs/optional/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/optional/nix-option-type.nix
@@ -0,0 +1,35 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:24
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] { }
diff --git a/test_resources/docs/optional/nix-options.nix b/test_resources/docs/optional/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/optional/nix-options.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:24
-# To update this it, run the test with --golden-reset
-{ lib }:
-{ }
diff --git a/test_resources/docs/same-help/nix-option-type.nix b/test_resources/docs/same-help/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/same-help/nix-option-type.nix
@@ -0,0 +1,51 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:33
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  int = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "int or string";
+    type = lib.types.nullOr lib.types.int;
+  };
+  other = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "int or string";
+    type = lib.types.nullOr lib.types.bool;
+  };
+  string = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "int or string";
+    type = lib.types.nullOr lib.types.str;
+  };
+}
diff --git a/test_resources/docs/same-help/nix-options.nix b/test_resources/docs/same-help/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/same-help/nix-options.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:33
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  int = lib.mkOption {
-    default = null;
-    description = "int or string";
-    type = lib.types.nullOr lib.types.int;
-  };
-  other = lib.mkOption {
-    default = null;
-    description = "int or string";
-    type = lib.types.nullOr lib.types.bool;
-  };
-  string = lib.mkOption {
-    default = null;
-    description = "int or string";
-    type = lib.types.nullOr lib.types.str;
-  };
-}
diff --git a/test_resources/docs/secret/nix-option-type.nix b/test_resources/docs/secret/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/secret/nix-option-type.nix
@@ -0,0 +1,51 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:35
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  first-secret-file = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "First example secret";
+    type = lib.types.nullOr lib.types.str;
+  };
+  second-secret = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "Second example secret, bare or in a file, only conf";
+    type = lib.types.nullOr lib.types.str;
+  };
+  second-secret-file = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "Second example secret, bare or in a file, only conf";
+    type = lib.types.nullOr lib.types.str;
+  };
+}
diff --git a/test_resources/docs/secret/nix-options.nix b/test_resources/docs/secret/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/secret/nix-options.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:35
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  first-secret-file = lib.mkOption {
-    default = null;
-    description = "First example secret";
-    type = lib.types.nullOr lib.types.str;
-  };
-  second-secret = lib.mkOption {
-    default = null;
-    description = "Second example secret, bare or in a file, only conf";
-    type = lib.types.nullOr lib.types.str;
-  };
-  second-secret-file = lib.mkOption {
-    default = null;
-    description = "Second example secret, bare or in a file, only conf";
-    type = lib.types.nullOr lib.types.str;
-  };
-}
diff --git a/test_resources/docs/some-args/nix-option-type.nix b/test_resources/docs/some-args/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/some-args/nix-option-type.nix
@@ -0,0 +1,35 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:23
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] { }
diff --git a/test_resources/docs/some-args/nix-options.nix b/test_resources/docs/some-args/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/some-args/nix-options.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:23
-# To update this it, run the test with --golden-reset
-{ lib }:
-{ }
diff --git a/test_resources/docs/sub-commands/nix-option-type.nix b/test_resources/docs/sub-commands/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/sub-commands/nix-option-type.nix
@@ -0,0 +1,41 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:39
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  name = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "name";
+    type = lib.types.nullOr lib.types.str;
+  };
+}
diff --git a/test_resources/docs/sub-commands/nix-options.nix b/test_resources/docs/sub-commands/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/sub-commands/nix-options.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:39
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  name = lib.mkOption {
-    default = null;
-    description = "name";
-    type = lib.types.nullOr lib.types.str;
-  };
-}
diff --git a/test_resources/docs/sub-settings/nix-option-type.nix b/test_resources/docs/sub-settings/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/sub-settings/nix-option-type.nix
@@ -0,0 +1,49 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:26
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  foo = lib.mkOption {
+    type = definedSubmodule [] {
+      bar = lib.mkOption {
+        type = definedSubmodule [] {
+          quux = lib.mkOption {
+            defaultText = lib.literalMD "Unspecified";
+            description = "Example with sub-settings";
+            type = lib.types.nullOr lib.types.str;
+          };
+        };
+      };
+    };
+  };
+}
diff --git a/test_resources/docs/sub-settings/nix-options.nix b/test_resources/docs/sub-settings/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/sub-settings/nix-options.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:26
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  foo = lib.mkOption {
-    default = { };
-    type = lib.types.submodule {
-      options = {
-        bar = lib.mkOption {
-          default = { };
-          type = lib.types.submodule {
-            options = {
-              quux = lib.mkOption {
-                default = null;
-                description = "Example with sub-settings";
-                type = lib.types.nullOr lib.types.str;
-              };
-            };
-          };
-        };
-      };
-    };
-  };
-}
diff --git a/test_resources/docs/sum-type/nix-option-type.nix b/test_resources/docs/sum-type/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/sum-type/nix-option-type.nix
@@ -0,0 +1,41 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:34
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  sum-type = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "example";
+    type = lib.types.nullOr lib.types.str;
+  };
+}
diff --git a/test_resources/docs/sum-type/nix-options.nix b/test_resources/docs/sum-type/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/sum-type/nix-options.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:34
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  sum-type = lib.mkOption {
-    default = null;
-    description = "example";
-    type = lib.types.nullOr lib.types.str;
-  };
-}
diff --git a/test_resources/docs/three-commands/nix-option-type.nix b/test_resources/docs/three-commands/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/three-commands/nix-option-type.nix
@@ -0,0 +1,46 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:38
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  enable = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "enable extra";
+    type = lib.types.nullOr lib.types.bool;
+  };
+  number = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "number";
+    type = lib.types.nullOr lib.types.int;
+  };
+}
diff --git a/test_resources/docs/three-commands/nix-options.nix b/test_resources/docs/three-commands/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/three-commands/nix-options.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:38
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  enable = lib.mkOption {
-    default = null;
-    description = "enable extra";
-    type = lib.types.nullOr lib.types.bool;
-  };
-  number = lib.mkOption {
-    default = null;
-    description = "number";
-    type = lib.types.nullOr lib.types.int;
-  };
-}
diff --git a/test_resources/docs/verbose/nix-option-type.nix b/test_resources/docs/verbose/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/verbose/nix-option-type.nix
@@ -0,0 +1,35 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:32
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] { }
diff --git a/test_resources/docs/verbose/nix-options.nix b/test_resources/docs/verbose/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/verbose/nix-options.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:32
-# To update this it, run the test with --golden-reset
-{ lib }:
-{ }
diff --git a/test_resources/docs/with-default/nix-option-type.nix b/test_resources/docs/with-default/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/with-default/nix-option-type.nix
@@ -0,0 +1,35 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:36
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] { }
diff --git a/test_resources/docs/with-default/nix-options.nix b/test_resources/docs/with-default/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/with-default/nix-options.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:36
-# To update this it, run the test with --golden-reset
-{ lib }:
-{ }
diff --git a/test_resources/docs/yes-no-optional/nix-option-type.nix b/test_resources/docs/yes-no-optional/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/yes-no-optional/nix-option-type.nix
@@ -0,0 +1,41 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:31
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  example = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "Example of a yes/no switch";
+    type = lib.types.nullOr lib.types.bool;
+  };
+}
diff --git a/test_resources/docs/yes-no-optional/nix-options.nix b/test_resources/docs/yes-no-optional/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/yes-no-optional/nix-options.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:31
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  example = lib.mkOption {
-    default = null;
-    description = "Example of a yes/no switch";
-    type = lib.types.nullOr lib.types.bool;
-  };
-}
diff --git a/test_resources/docs/yes-no/nix-option-type.nix b/test_resources/docs/yes-no/nix-option-type.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/docs/yes-no/nix-option-type.nix
@@ -0,0 +1,41 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by
+# opt-env-conf-test:test/OptEnvConf/APISpec.hs:29
+# To update this it, run the test with --golden-reset
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  example = lib.mkOption {
+    defaultText = lib.literalMD "Unspecified";
+    description = "Example of a yes/no switch";
+    type = lib.types.nullOr lib.types.bool;
+  };
+}
diff --git a/test_resources/docs/yes-no/nix-options.nix b/test_resources/docs/yes-no/nix-options.nix
deleted file mode 100644
--- a/test_resources/docs/yes-no/nix-options.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-# DO NOT EDIT THIS FILE DIRECTLY
-# This file was generated by
-# opt-env-conf-test:test/OptEnvConf/APISpec.hs:29
-# To update this it, run the test with --golden-reset
-{ lib }:
-{
-  example = lib.mkOption {
-    default = null;
-    description = "Example of a yes/no switch";
-    type = lib.types.nullOr lib.types.bool;
-  };
-}
diff --git a/test_resources/nix-option-type-with-generated-comment.nix b/test_resources/nix-option-type-with-generated-comment.nix
new file mode 100644
--- /dev/null
+++ b/test_resources/nix-option-type-with-generated-comment.nix
@@ -0,0 +1,49 @@
+# DO NOT EDIT THIS FILE DIRECTLY
+# This file was generated by running
+# sub-settings --render-nix-option-type
+{ lib }:
+let
+  definedSubmodule = required: declarations: definedType required (lib.types.submodule {
+    options = declarations;
+  });
+  definedType = required: submodule: submodule // {
+    emptyValue = { };
+    functor = submodule.functor // {
+      name = "definedSubmodule";
+    };
+    merge = submodule.merge // {
+      v2 = args: let
+        configValue = name: lib.getAttr name merged.value;
+        isDefined = name: (lib.getAttr name options).isDefined;
+        merged = submodule.merge.v2 args;
+        options = merged.valueMeta.configuration.options;
+        requiredValue = name: if isDefined name then configValue name else throw (lib.concatStrings [
+          "The option `"
+          (lib.showOption (lib.getAttr name options).loc)
+          "' is required but was not defined."
+        ]);
+      in
+      merged // {
+        value = lib.genAttrs required requiredValue // lib.genAttrs (lib.filter isDefined (lib.attrNames (lib.removeAttrs options ["_module"]))) configValue;
+      };
+    };
+    substSubModules = modules: definedType required (submodule.substSubModules modules);
+    typeMerge = _: null;
+  };
+in
+definedSubmodule [] {
+  foo = lib.mkOption {
+    type = definedSubmodule [] {
+      bar = lib.mkOption {
+        type = definedSubmodule [] {
+          quux = lib.mkOption {
+            defaultText = lib.literalMD "Unspecified";
+            description = "Example with sub-settings";
+            type = lib.types.nullOr lib.types.str;
+          };
+        };
+      };
+    };
+  };
+}
+
