diff options
Diffstat (limited to 'doc/manual/expressions/language-constructs.xml')
-rw-r--r-- | doc/manual/expressions/language-constructs.xml | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/doc/manual/expressions/language-constructs.xml b/doc/manual/expressions/language-constructs.xml index 0d0cbbe15..4d316609c 100644 --- a/doc/manual/expressions/language-constructs.xml +++ b/doc/manual/expressions/language-constructs.xml @@ -278,7 +278,9 @@ evaluate to a Boolean value. If it evaluates to <literal>true</literal>, <replaceable>e2</replaceable> is returned; otherwise expression evaluation is aborted and a backtrace is printed.</para> -<example xml:id='ex-subversion-nix'><title>Nix expression for Subversion</title> +<para>Here is a Nix expression for the Subversion package that shows +how assertions can be used:.</para> + <programlisting> { localServer ? false , httpServer ? false @@ -290,9 +292,9 @@ otherwise expression evaluation is aborted and a backtrace is printed.</para> , openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null }: -assert localServer -> db4 != null; <co xml:id='ex-subversion-nix-co-1' /> -assert httpServer -> httpd != null && httpd.expat == expat; <co xml:id='ex-subversion-nix-co-2' /> -assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); <co xml:id='ex-subversion-nix-co-3' /> +assert localServer -> db4 != null; ① +assert httpServer -> httpd != null && httpd.expat == expat; ② +assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); ③ assert pythonBindings -> swig != null && swig.pythonSupport; assert javaSwigBindings -> swig != null && swig.javaSupport; assert javahlBindings -> j2sdk != null; @@ -300,26 +302,24 @@ assert javahlBindings -> j2sdk != null; stdenv.mkDerivation { name = "subversion-1.1.1"; ... - openssl = if sslSupport then openssl else null; <co xml:id='ex-subversion-nix-co-4' /> + openssl = if sslSupport then openssl else null; ④ ... }</programlisting> -</example> -<para><xref linkend='ex-subversion-nix' /> show how assertions are -used in the Nix expression for Subversion.</para> +<para>The points of interest are:</para> -<calloutlist> +<orderedlist> - <callout arearefs='ex-subversion-nix-co-1'> + <listitem> <para>This assertion states that if Subversion is to have support for local repositories, then Berkeley DB is needed. So if the Subversion function is called with the <varname>localServer</varname> argument set to <literal>true</literal> but the <varname>db4</varname> argument set to <literal>null</literal>, then the evaluation fails.</para> - </callout> + </listitem> - <callout arearefs='ex-subversion-nix-co-2'> + <listitem> <para>This is a more subtle condition: if Subversion is built with Apache (<literal>httpServer</literal>) support, then the Expat library (an XML library) used by Subversion should be same as the @@ -327,27 +327,27 @@ used in the Nix expression for Subversion.</para> Subversion code ends up being linked with Apache code, and if the Expat libraries do not match, a build- or runtime link error or incompatibility might occur.</para> - </callout> + </listitem> - <callout arearefs='ex-subversion-nix-co-3'> + <listitem> <para>This assertion says that in order for Subversion to have SSL support (so that it can access <literal>https</literal> URLs), an OpenSSL library must be passed. Additionally, it says that <emphasis>if</emphasis> Apache support is enabled, then Apache's OpenSSL should match Subversion's. (Note that if Apache support is not enabled, we don't care about Apache's OpenSSL.)</para> - </callout> + </listitem> - <callout arearefs='ex-subversion-nix-co-4'> + <listitem> <para>The conditional here is not really related to assertions, but is worth pointing out: it ensures that if SSL support is disabled, then the Subversion derivation is not dependent on OpenSSL, even if a non-<literal>null</literal> value was passed. This prevents an unnecessary rebuild of Subversion if OpenSSL changes.</para> - </callout> + </listitem> -</calloutlist> +</orderedlist> </simplesect> |