opt-env-conf-test 0.0.0.5 → 0.1.0.0
raw patch · 43 files changed
+888/−276 lines, 43 filesdep ~opt-env-conf
Dependency ranges changed: opt-env-conf
Files
- CHANGELOG.md +12/−0
- opt-env-conf-test.cabal +23/−22
- src/OptEnvConf/Test.hs +12/−12
- test/OptEnvConf/APISpec.hs +7/−2
- test_resources/docs/big-config/nix-option-type.nix +51/−0
- test_resources/docs/big-config/nix-options.nix +0/−22
- test_resources/docs/empty/nix-option-type.nix +35/−0
- test_resources/docs/empty/nix-options.nix +0/−6
- test_resources/docs/enable-disable-optional/nix-option-type.nix +41/−0
- test_resources/docs/enable-disable-optional/nix-options.nix +0/−12
- test_resources/docs/enable-disable/nix-option-type.nix +41/−0
- test_resources/docs/enable-disable/nix-options.nix +0/−12
- test_resources/docs/greet/nix-option-type.nix +46/−0
- test_resources/docs/greet/nix-options.nix +0/−17
- test_resources/docs/hidden/nix-option-type.nix +35/−0
- test_resources/docs/hidden/nix-options.nix +0/−6
- test_resources/docs/many-args/nix-option-type.nix +35/−0
- test_resources/docs/many-args/nix-options.nix +0/−6
- test_resources/docs/optional/nix-option-type.nix +35/−0
- test_resources/docs/optional/nix-options.nix +0/−6
- test_resources/docs/same-help/nix-option-type.nix +51/−0
- test_resources/docs/same-help/nix-options.nix +0/−22
- test_resources/docs/secret/nix-option-type.nix +51/−0
- test_resources/docs/secret/nix-options.nix +0/−22
- test_resources/docs/some-args/nix-option-type.nix +35/−0
- test_resources/docs/some-args/nix-options.nix +0/−6
- test_resources/docs/sub-commands/nix-option-type.nix +41/−0
- test_resources/docs/sub-commands/nix-options.nix +0/−12
- test_resources/docs/sub-settings/nix-option-type.nix +49/−0
- test_resources/docs/sub-settings/nix-options.nix +0/−26
- test_resources/docs/sum-type/nix-option-type.nix +41/−0
- test_resources/docs/sum-type/nix-options.nix +0/−12
- test_resources/docs/three-commands/nix-option-type.nix +46/−0
- test_resources/docs/three-commands/nix-options.nix +0/−17
- test_resources/docs/verbose/nix-option-type.nix +35/−0
- test_resources/docs/verbose/nix-options.nix +0/−6
- test_resources/docs/with-default/nix-option-type.nix +35/−0
- test_resources/docs/with-default/nix-options.nix +0/−6
- test_resources/docs/yes-no-optional/nix-option-type.nix +41/−0
- test_resources/docs/yes-no-optional/nix-options.nix +0/−12
- test_resources/docs/yes-no/nix-option-type.nix +41/−0
- test_resources/docs/yes-no/nix-options.nix +0/−12
- test_resources/nix-option-type-with-generated-comment.nix +49/−0
CHANGELOG.md view
@@ -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
opt-env-conf-test.cabal view
@@ -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
src/OptEnvConf/Test.hs view
@@ -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 =
test/OptEnvConf/APISpec.hs view
@@ -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 =
+ test_resources/docs/big-config/nix-option-type.nix view
@@ -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;+ };+ });+ };+}
− test_resources/docs/big-config/nix-options.nix
@@ -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;- };- };- });- };-}
+ test_resources/docs/empty/nix-option-type.nix view
@@ -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 [] { }
− test_resources/docs/empty/nix-options.nix
@@ -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 }:-{ }
+ test_resources/docs/enable-disable-optional/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/enable-disable-optional/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/enable-disable/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/enable-disable/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/greet/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/greet/nix-options.nix
@@ -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;- };-}
@@ -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 [] { }
@@ -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 }:-{ }
+ test_resources/docs/many-args/nix-option-type.nix view
@@ -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 [] { }
− test_resources/docs/many-args/nix-options.nix
@@ -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 }:-{ }
+ test_resources/docs/optional/nix-option-type.nix view
@@ -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 [] { }
− test_resources/docs/optional/nix-options.nix
@@ -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 }:-{ }
+ test_resources/docs/same-help/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/same-help/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/secret/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/secret/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/some-args/nix-option-type.nix view
@@ -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 [] { }
− test_resources/docs/some-args/nix-options.nix
@@ -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 }:-{ }
+ test_resources/docs/sub-commands/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/sub-commands/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/sub-settings/nix-option-type.nix view
@@ -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;+ };+ };+ };+ };+ };+}
− test_resources/docs/sub-settings/nix-options.nix
@@ -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;- };- };- };- };- };- };- };-}
+ test_resources/docs/sum-type/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/sum-type/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/three-commands/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/three-commands/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/verbose/nix-option-type.nix view
@@ -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 [] { }
− test_resources/docs/verbose/nix-options.nix
@@ -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 }:-{ }
+ test_resources/docs/with-default/nix-option-type.nix view
@@ -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 [] { }
− test_resources/docs/with-default/nix-options.nix
@@ -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 }:-{ }
+ test_resources/docs/yes-no-optional/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/yes-no-optional/nix-options.nix
@@ -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;- };-}
+ test_resources/docs/yes-no/nix-option-type.nix view
@@ -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;+ };+}
− test_resources/docs/yes-no/nix-options.nix
@@ -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;- };-}
+ test_resources/nix-option-type-with-generated-comment.nix view
@@ -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;+ };+ };+ };+ };+ };+}+