Skip to content

Commit ee4f8c2

Browse files
committedMay 24, 2017
nixos doc: document coercedTo type
Also mention about docs in types.nix and fix a small error in related documentation. Fixes #26055.
1 parent 8a07319 commit ee4f8c2

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
 

‎lib/types.nix

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ rec {
9292
};
9393

9494

95+
# When adding new types don't forget to document them in
96+
# nixos/doc/manual/development/option-types.xml!
9597
types = rec {
9698

9799
unspecified = mkOptionType {

‎nixos/doc/manual/development/option-types.xml

+12-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@
6868

6969
<section><title>Value Types</title>
7070

71-
<para>Value types are type that take a value parameter. The only value type
72-
in the library is <literal>enum</literal>.</para>
71+
<para>Value types are type that take a value parameter.</para>
7372

7473
<variablelist>
7574
<varlistentry>
@@ -141,6 +140,17 @@
141140
str</literal>. Multiple definitions cannot be
142141
merged.</para></listitem>
143142
</varlistentry>
143+
<varlistentry>
144+
<term><varname>types.coercedTo</varname> <replaceable>from</replaceable>
145+
<replaceable>f</replaceable> <replaceable>to</replaceable></term>
146+
<listitem><para>Type <replaceable>to</replaceable> or type
147+
<replaceable>from</replaceable> which will be coerced to
148+
type <replaceable>to</replaceable> using function
149+
<replaceable>f</replaceable> which takes an argument of type
150+
<replaceable>from</replaceable> and return a value of type
151+
<replaceable>to</replaceable>. Can be used to preserve backwards
152+
compatibility of an option if its type was changed.</para></listitem>
153+
</varlistentry>
144154
</variablelist>
145155

146156
</section>

1 commit comments

Comments
 (1)

Profpatsch commented on May 24, 2017

@Profpatsch
Member

Looks good!

Please sign in to comment.