diff options
-rw-r--r-- | lib/types.nix | 2 | ||||
-rw-r--r-- | nixos/doc/manual/development/option-types.xml | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/types.nix b/lib/types.nix index 45122759bfc..b06cc9eedaa 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -92,6 +92,8 @@ rec { }; + # When adding new types don't forget to document them in + # nixos/doc/manual/development/option-types.xml! types = rec { unspecified = mkOptionType { diff --git a/nixos/doc/manual/development/option-types.xml b/nixos/doc/manual/development/option-types.xml index 741e763c295..e928c557087 100644 --- a/nixos/doc/manual/development/option-types.xml +++ b/nixos/doc/manual/development/option-types.xml @@ -68,8 +68,7 @@ <section><title>Value Types</title> - <para>Value types are type that take a value parameter. The only value type - in the library is <literal>enum</literal>.</para> + <para>Value types are type that take a value parameter.</para> <variablelist> <varlistentry> @@ -141,6 +140,17 @@ str</literal>. Multiple definitions cannot be merged.</para></listitem> </varlistentry> + <varlistentry> + <term><varname>types.coercedTo</varname> <replaceable>from</replaceable> + <replaceable>f</replaceable> <replaceable>to</replaceable></term> + <listitem><para>Type <replaceable>to</replaceable> or type + <replaceable>from</replaceable> which will be coerced to + type <replaceable>to</replaceable> using function + <replaceable>f</replaceable> which takes an argument of type + <replaceable>from</replaceable> and return a value of type + <replaceable>to</replaceable>. Can be used to preserve backwards + compatibility of an option if its type was changed.</para></listitem> + </varlistentry> </variablelist> </section> |