Revert "nixos/doc: re-format"
This reverts commit ea6e8775bd. The new
format is not an improvement.
This commit is contained in:
@@ -6,11 +6,18 @@
|
||||
<title>Warnings and Assertions</title>
|
||||
|
||||
<para>
|
||||
When configuration problems are detectable in a module, it is a good idea to write an assertion or warning. Doing so provides clear feedback to the user and prevents errors after the build.
|
||||
When configuration problems are detectable in a module, it is a good idea to
|
||||
write an assertion or warning. Doing so provides clear feedback to the user
|
||||
and prevents errors after the build.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Although Nix has the <literal>abort</literal> and <literal>builtins.trace</literal> <link xlink:href="https://nixos.org/nix/manual/#ssec-builtins">functions</link> to perform such tasks, they are not ideally suited for NixOS modules. Instead of these functions, you can declare your warnings and assertions using the NixOS module system.
|
||||
Although Nix has the <literal>abort</literal> and
|
||||
<literal>builtins.trace</literal>
|
||||
<link xlink:href="https://nixos.org/nix/manual/#ssec-builtins">functions</link>
|
||||
to perform such tasks, they are not ideally suited for NixOS modules. Instead
|
||||
of these functions, you can declare your warnings and assertions using the
|
||||
NixOS module system.
|
||||
</para>
|
||||
|
||||
<section xml:id="sec-assertions-warnings">
|
||||
@@ -41,7 +48,12 @@
|
||||
<title>Assertions</title>
|
||||
|
||||
<para>
|
||||
This example, extracted from the <link xlink:href="https://github.com/NixOS/nixpkgs/blob/release-17.09/nixos/modules/services/logging/syslogd.nix"> <literal>syslogd</literal> module </link> shows how to use <literal>assertions</literal>. Since there can only be one active syslog daemon at a time, an assertion is useful to prevent such a broken system from being built.
|
||||
This example, extracted from the
|
||||
<link xlink:href="https://github.com/NixOS/nixpkgs/blob/release-17.09/nixos/modules/services/logging/syslogd.nix">
|
||||
<literal>syslogd</literal> module </link> shows how to use
|
||||
<literal>assertions</literal>. Since there can only be one active syslog
|
||||
daemon at a time, an assertion is useful to prevent such a broken system
|
||||
from being built.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
|
||||
Reference in New Issue
Block a user