nixos doc: document coercedTo type

Also mention about docs in types.nix and fix a small error in related
documentation.

Fixes #26055.
This commit is contained in:
Nikolay Amiantov 2017-05-24 15:51:01 +03:00
parent 8a07319e7f
commit ee4f8c2dc9
2 changed files with 14 additions and 2 deletions

View File

@ -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 {

View File

@ -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>