summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-01-10 16:35:25 +0100
committerGitHub <noreply@github.com>2020-01-10 16:35:25 +0100
commit5239b328f8796192db8f8516fc5dc2d270c8ab10 (patch)
tree6c2e33d1695e2e8ee04e528fb72f39bfa17cc6ae /nixos
parentde26ac107f3fdf2e41775040ea65a192a1b5056f (diff)
parent9e97e6484722e26aab3978d027e85d394f170495 (diff)
downloadnixpkgs-5239b328f8796192db8f8516fc5dc2d270c8ab10.tar
nixpkgs-5239b328f8796192db8f8516fc5dc2d270c8ab10.tar.gz
nixpkgs-5239b328f8796192db8f8516fc5dc2d270c8ab10.tar.bz2
nixpkgs-5239b328f8796192db8f8516fc5dc2d270c8ab10.tar.lz
nixpkgs-5239b328f8796192db8f8516fc5dc2d270c8ab10.tar.xz
nixpkgs-5239b328f8796192db8f8516fc5dc2d270c8ab10.tar.zst
nixpkgs-5239b328f8796192db8f8516fc5dc2d270c8ab10.zip
lib/types: Introduce lazyAttrsOf (#70138)
lib/types: Introduce lazyAttrsOf
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/development/option-types.xml30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/doc/manual/development/option-types.xml b/nixos/doc/manual/development/option-types.xml
index 1ec7e3efad7..55d9c123e3f 100644
--- a/nixos/doc/manual/development/option-types.xml
+++ b/nixos/doc/manual/development/option-types.xml
@@ -352,6 +352,36 @@
       An attribute set of where all the values are of
       <replaceable>t</replaceable> type. Multiple definitions result in the
       joined attribute set.
+      <note><para>
+       This type is <emphasis>strict</emphasis> in its values, which in turn
+       means attributes cannot depend on other attributes. See <varname>
+       types.lazyAttrsOf</varname> for a lazy version.
+      </para></note>
+     </para>
+    </listitem>
+   </varlistentry>
+   <varlistentry>
+    <term>
+     <varname>types.lazyAttrsOf</varname> <replaceable>t</replaceable>
+    </term>
+    <listitem>
+     <para>
+      An attribute set of where all the values are of
+      <replaceable>t</replaceable> type. Multiple definitions result in the
+      joined attribute set. This is the lazy version of <varname>types.attrsOf
+      </varname>, allowing attributes to depend on each other.
+      <warning><para>
+       This version does not fully support conditional definitions! With an
+       option <varname>foo</varname> of this type and a definition
+       <literal>foo.attr = lib.mkIf false 10</literal>, evaluating
+       <literal>foo ? attr</literal> will return <literal>true</literal>
+       even though it should be false. Accessing the value will then throw
+       an error. For types <replaceable>t</replaceable> that have an
+       <literal>emptyValue</literal> defined, that value will be returned
+       instead of throwing an error. So if the type of <literal>foo.attr</literal>
+       was <literal>lazyAttrsOf (nullOr int)</literal>, <literal>null</literal>
+       would be returned instead for the same <literal>mkIf false</literal> definition.
+      </para></warning>
      </para>
     </listitem>
    </varlistentry>