+79
nixos/doc/manual/development/freeform-modules.section.md
+79
nixos/doc/manual/development/freeform-modules.section.md
···
-68
nixos/doc/manual/development/freeform-modules.xml
-68
nixos/doc/manual/development/freeform-modules.xml
···-Freeform modules allow you to define values for option paths that have not been declared explicitly. This can be used to add attribute-specific types to what would otherwise have to be <literal>attrsOf</literal> options in order to accept all attribute names.-This feature can be enabled by using the attribute <literal>freeformType</literal> to define a freeform type. By doing this, all assignments without an associated option will be merged using the freeform type and combined into the resulting <literal>config</literal> set. Since this feature nullifies name checking for entire option trees, it is only recommended for use in submodules.-The following shows a submodule assigning a freeform type that allows arbitrary attributes with <literal>str</literal> values below <literal>settings</literal>, but also declares an option for the <literal>settings.port</literal> attribute to have it type-checked and assign a default value. See <xref linkend="ex-settings-typed-attrs"/> for a more complete example.-Freeform attributes cannot depend on other attributes of the same set without infinite recursion:-To prevent this, declare options for all attributes that need to depend on others. For above example this means to declare <literal>logLevel</literal> to be an option.
+46
nixos/doc/manual/development/importing-modules.section.md
+46
nixos/doc/manual/development/importing-modules.section.md
···
-56
nixos/doc/manual/development/importing-modules.xml
-56
nixos/doc/manual/development/importing-modules.xml
···
+40
nixos/doc/manual/development/meta-attributes.section.md
+40
nixos/doc/manual/development/meta-attributes.section.md
···
-63
nixos/doc/manual/development/meta-attributes.xml
-63
nixos/doc/manual/development/meta-attributes.xml
···-xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/misc/meta.nix">meta.nix</filename>
+136
nixos/doc/manual/development/option-declarations.section.md
+136
nixos/doc/manual/development/option-declarations.section.md
···+([Example: Extensible type placeholder in the service module](#ex-option-declaration-eot-service)),+([Example: Extending `services.xserver.displayManager.enable` in the `gdm` module](#ex-option-declaration-eot-backend-gdm),+[Example: Extending `services.xserver.displayManager.enable` in the `sddm` module](#ex-option-declaration-eot-backend-sddm)).
-199
nixos/doc/manual/development/option-declarations.xml
-199
nixos/doc/manual/development/option-declarations.xml
···-<title>Extending <literal>services.xserver.displayManager.enable</literal> in the <literal>gdm</literal> module</title>-<title>Extending <literal>services.xserver.displayManager.enable</literal> in the <literal>sddm</literal> module</title>
+91
nixos/doc/manual/development/option-def.section.md
+91
nixos/doc/manual/development/option-def.section.md
···
-99
nixos/doc/manual/development/option-def.xml
-99
nixos/doc/manual/development/option-def.xml
···-environment.systemPackages = if config.services.httpd.enable then [ <replaceable>...</replaceable> ] else [];
+558
nixos/doc/manual/development/option-types.section.md
+558
nixos/doc/manual/development/option-types.section.md
···+`types.submoduleWith` { *`modules`*, *`specialArgs`* ? {}, *`shorthandOnlyDefinesConfig`* ? false }+([Example: Declaration of a list of submodules](#ex-submodule-listof-declaration)), `submodule` allows+([Example: Declaration of attribute sets of submodules](#ex-submodule-attrsof-declaration)), `submodule` allows
-914
nixos/doc/manual/development/option-types.xml
-914
nixos/doc/manual/development/option-types.xml
···-<varname>types.ints.between</varname> <replaceable>lowest</replaceable> <replaceable>highest</replaceable>-returning an attribute set, or a path to a file containing such a value. Submodules are used in-<literal>types.submoduleWith { modules = toList o; shorthandOnlyDefinesConfig = true; }</literal>.-for most arguments since it allows overriding. <replaceable>specialArgs</replaceable> should only be-<varname>types.oneOf</varname> [ <replaceable>t1</replaceable> <replaceable>t2</replaceable> ... ]-<varname>types.coercedTo</varname> <replaceable>from</replaceable> <replaceable>f</replaceable> <replaceable>to</replaceable>
+64
nixos/doc/manual/development/replace-modules.section.md
+64
nixos/doc/manual/development/replace-modules.section.md
···
-79
nixos/doc/manual/development/replace-modules.xml
-79
nixos/doc/manual/development/replace-modules.xml
···
+192
nixos/doc/manual/development/settings-options.section.md
+192
nixos/doc/manual/development/settings-options.section.md
···
-226
nixos/doc/manual/development/settings-options.xml
-226
nixos/doc/manual/development/settings-options.xml
···-Many programs have configuration files where program-specific settings can be declared. File formats can be separated into two categories:-Nix-representable ones: These can trivially be mapped to a subset of Nix syntax. E.g. JSON is an example, since its values like <literal>{"foo":{"bar":10}}</literal> can be mapped directly to Nix: <literal>{ foo = { bar = 10; }; }</literal>. Other examples are INI, YAML and TOML. The following section explains the convention for these settings.-Non-nix-representable ones: These can't be trivially mapped to a subset of Nix syntax. Most generic programming languages are in this group, e.g. bash, since the statement <literal>if true; then echo hi; fi</literal> doesn't have a trivial representation in Nix.-Currently there are no fixed conventions for these, but it is common to have a <literal>configFile</literal> option for setting the configuration file path directly. The default value of <literal>configFile</literal> can be an auto-generated file, with convenient options for controlling the contents. For example an option of type <literal>attrsOf str</literal> can be used for representing environment variables which generates a section like <literal>export FOO="foo"</literal>. Often it can also be useful to also include an <literal>extraConfig</literal> option of type <literal>lines</literal> to allow arbitrary text after the autogenerated part of the file.-By convention, formats like this are handled with a generic <literal>settings</literal> option, representing the full program configuration as a Nix value. The type of this option should represent the format. The most common formats have a predefined type and string generator already declared under <literal>pkgs.formats</literal>:-A function taking an empty attribute set (for future extensibility) and returning a set with JSON-specific attributes <varname>type</varname> and <varname>generate</varname> as specified <link linkend='pkgs-formats-result'>below</link>.-A function taking an empty attribute set (for future extensibility) and returning a set with YAML-specific attributes <varname>type</varname> and <varname>generate</varname> as specified <link linkend='pkgs-formats-result'>below</link>.-<varname>pkgs.formats.ini</varname> { <replaceable>listsAsDuplicateKeys</replaceable> ? false, <replaceable>listToValue</replaceable> ? null, ... }-It returns a set with INI-specific attributes <varname>type</varname> and <varname>generate</varname> as specified <link linkend='pkgs-formats-result'>below</link>.-A function taking an empty attribute set (for future extensibility) and returning a set with TOML-specific attributes <varname>type</varname> and <varname>generate</varname> as specified <link linkend='pkgs-formats-result'>below</link>.-<varname>generate</varname> <replaceable>filename</replaceable> <replaceable>jsonValue</replaceable>-This function puts the value contents in the Nix store. So this should be avoided for secrets.-The following shows a module for an example program that uses a JSON configuration file. It demonstrates how above values can be used, along with some other related best practices. See the comments for explanations.-Some <literal>settings</literal> attributes may deserve some extra care. They may need a different type, default or merging behavior, or they are essential options that should show their documentation in the manual. This can be done using <xref linkend='sec-freeform-modules'/>.-We extend above example using freeform modules to declare an option for the port, which will enforce it to be a valid integer and make it show up in the manual.
+8
-8
nixos/doc/manual/development/writing-modules.xml
+8
-8
nixos/doc/manual/development/writing-modules.xml
···
+87
nixos/doc/manual/from_md/development/freeform-modules.section.xml
+87
nixos/doc/manual/from_md/development/freeform-modules.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-freeform-modules">
+47
nixos/doc/manual/from_md/development/importing-modules.section.xml
+47
nixos/doc/manual/from_md/development/importing-modules.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-importing-modules">
+55
nixos/doc/manual/from_md/development/meta-attributes.section.xml
+55
nixos/doc/manual/from_md/development/meta-attributes.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-meta-attributes">
+203
nixos/doc/manual/from_md/development/option-declarations.section.xml
+203
nixos/doc/manual/from_md/development/option-declarations.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-option-declarations">
+104
nixos/doc/manual/from_md/development/option-def.section.xml
+104
nixos/doc/manual/from_md/development/option-def.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-option-definitions">
+987
nixos/doc/manual/from_md/development/option-types.section.xml
+987
nixos/doc/manual/from_md/development/option-types.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-option-types">+<literal>types.submoduleWith { modules = toList o; shorthandOnlyDefinesConfig = true; }</literal>.+<literal>[ { file = "/foo.nix"; value = 1; } { file = "/bar.nix"; value = 2 } ]</literal>.
+70
nixos/doc/manual/from_md/development/replace-modules.section.xml
+70
nixos/doc/manual/from_md/development/replace-modules.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-replace-modules">
+285
nixos/doc/manual/from_md/development/settings-options.section.xml
+285
nixos/doc/manual/from_md/development/settings-options.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-settings-options">