summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-08-05 16:44:12 +0200
committerProfpatsch <mail@profpatsch.de>2017-11-05 15:56:32 +0100
commit3e3bfc66f7b98d7b57f67ba201dd446be9512078 (patch)
treeb3ecd91002730eaaaec13e180b0df81086f1949a /nixos
parentc776489cacb32d2cbfe0ba2622b2b6e4d27bae7d (diff)
downloadnixpkgs-3e3bfc66f7b98d7b57f67ba201dd446be9512078.tar
nixpkgs-3e3bfc66f7b98d7b57f67ba201dd446be9512078.tar.gz
nixpkgs-3e3bfc66f7b98d7b57f67ba201dd446be9512078.tar.bz2
nixpkgs-3e3bfc66f7b98d7b57f67ba201dd446be9512078.tar.lz
nixpkgs-3e3bfc66f7b98d7b57f67ba201dd446be9512078.tar.xz
nixpkgs-3e3bfc66f7b98d7b57f67ba201dd446be9512078.tar.zst
nixpkgs-3e3bfc66f7b98d7b57f67ba201dd446be9512078.zip
lib/types: nixos manual documentation for signed/unsinged int
Synchronize the manual for the new types.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/development/option-types.xml83
1 files changed, 69 insertions, 14 deletions
diff --git a/nixos/doc/manual/development/option-types.xml b/nixos/doc/manual/development/option-types.xml
index dedfc286ca3..ccdbc0900be 100644
--- a/nixos/doc/manual/development/option-types.xml
+++ b/nixos/doc/manual/development/option-types.xml
@@ -23,30 +23,74 @@
         <literal>false</literal>.</para></listitem>
   </varlistentry>
   <varlistentry>
+    <term><varname>types.path</varname></term>
+    <listitem><para>A filesystem path, defined as anything that when coerced to 
+        a string starts with a slash. Even if derivations can be considered as 
+        path, the more specific <literal>types.package</literal> should be 
+        preferred.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><varname>types.package</varname></term>
+    <listitem><para>A derivation or a store path.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Integer related types:</para>
+
+<variablelist>
+  <varlistentry>
+    <term>
+      <varname>types.ints.signed</varname>
+    </term>
+    <listitem><para>A signed integer.
+    </para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <varname>types.ints{signed8, signed16, signed32}</varname>
+    </term>
+    <listitem>
+      <para>Signed integers with a fixed length (8, 16 or 32 bits).
+        They go from
+        <inlineequation><mathphrase>−2<superscript>n</superscript>/2</mathphrase>
+        </inlineequation> to <inlineequation>
+        <mathphrase>2<superscript>n</superscript>/2−1</mathphrase>
+        </inlineequation>
+        respectively (e.g. <literal>−128</literal> to <literal>127</literal>
+        for 8 bits).
+    </para></listitem>
+  </varlistentry>
+  <varlistentry>
     <term><varname>types.int</varname></term>
-    <listitem><para>An integer.</para></listitem>
+    <listitem><para>A convenience alias for <literal>ints.signed</literal>.
+    </para></listitem>
   </varlistentry>
   <varlistentry>
     <term>
-      <varname>types.intBetween</varname>
-      <replaceable>min</replaceable>
-      <replaceable>max</replaceable>
+      <varname>types.ints.unsigned</varname>
     </term>
-    <listitem><para>An integer between <replaceable>min</replaceable>
-        and <replaceable>max</replaceable> (both inclusive).
-        Useful for e.g. port ranges.
+    <listitem><para>An unsigned integer (that is ≥ 0).
     </para></listitem>
   </varlistentry>
   <varlistentry>
-    <term><varname>types.path</varname></term>
-    <listitem><para>A filesystem path, defined as anything that when coerced to 
-        a string starts with a slash. Even if derivations can be considered as 
-        path, the more specific <literal>types.package</literal> should be 
-        preferred.</para></listitem>
+    <term>
+      <varname>types.ints{unsigned8, unsigned16, unsigned32}</varname>
+    </term>
+    <listitem>
+      <para>Unsigned integers with a fixed length (8, 16 or 32 bits).
+        They go from
+        <inlineequation><mathphrase>0</mathphrase></inlineequation> to <inlineequation>
+        <mathphrase>2<superscript>n</superscript>−1</mathphrase>
+        </inlineequation>
+        respectively (e.g. <literal>0</literal> to <literal>255</literal>
+        for 8 bits).
+    </para></listitem>
   </varlistentry>
   <varlistentry>
-    <term><varname>types.package</varname></term>
-    <listitem><para>A derivation or a store path.</para></listitem>
+    <term>
+      <varname>types.port</varname>
+    </term>
+    <listitem><para>A network port number (0–65635).</para></listitem>
   </varlistentry>
 </variablelist>
 
@@ -96,6 +140,17 @@
           "|"</literal>.</para></listitem>
   </varlistentry>
   <varlistentry>
+    <term>
+      <varname>types.ints.between</varname>
+      <replaceable>lowest</replaceable>
+      <replaceable>highest</replaceable>
+    </term>
+    <listitem><para>An integer between <replaceable>lowest</replaceable>
+        and <replaceable>highest</replaceable> (both inclusive).
+        Useful for e.g. creating types like <literal>types.port</literal>.
+    </para></listitem>
+  </varlistentry>
+  <varlistentry>
     <term><varname>types.submodule</varname> <replaceable>o</replaceable></term>
     <listitem><para>A set of sub options <replaceable>o</replaceable>.
         <replaceable>o</replaceable> can be an attribute set or a function