diff options
author | pennae <github@quasiparticle.net> | 2023-02-08 11:08:25 +0100 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2023-02-10 06:40:15 +0100 |
commit | d041641b1abc901191947cd9d7676cd803ccd00b (patch) | |
tree | e13a6f2dca1c98b55bd17d6b2c9ac00a99de9364 /nixos/doc/manual/from_md/development/assertions.section.xml | |
parent | 652a283e51d57ed294cb07774ebf7b95b1a7e59c (diff) | |
download | nixpkgs-d041641b1abc901191947cd9d7676cd803ccd00b.tar nixpkgs-d041641b1abc901191947cd9d7676cd803ccd00b.tar.gz nixpkgs-d041641b1abc901191947cd9d7676cd803ccd00b.tar.bz2 nixpkgs-d041641b1abc901191947cd9d7676cd803ccd00b.tar.lz nixpkgs-d041641b1abc901191947cd9d7676cd803ccd00b.tar.xz nixpkgs-d041641b1abc901191947cd9d7676cd803ccd00b.tar.zst nixpkgs-d041641b1abc901191947cd9d7676cd803ccd00b.zip |
nixos/manual: remove md-to-db
with manual chapters no longer needing pandoc for their conversion to xml we can get rid of this source of confusion, and its huge cache of xml files.
Diffstat (limited to 'nixos/doc/manual/from_md/development/assertions.section.xml')
-rw-r--r-- | nixos/doc/manual/from_md/development/assertions.section.xml | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/nixos/doc/manual/from_md/development/assertions.section.xml b/nixos/doc/manual/from_md/development/assertions.section.xml deleted file mode 100644 index 13f04d5d188..00000000000 --- a/nixos/doc/manual/from_md/development/assertions.section.xml +++ /dev/null @@ -1,58 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-assertions"> - <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. - </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. - </para> - <section xml:id="sec-assertions-warnings"> - <title>Warnings</title> - <para> - This is an example of using <literal>warnings</literal>. - </para> - <programlisting language="nix"> -{ config, lib, ... }: -{ - config = lib.mkIf config.services.foo.enable { - warnings = - if config.services.foo.bar - then [ ''You have enabled the bar feature of the foo service. - This is known to cause some specific problems in certain situations. - '' ] - else []; - } -} -</programlisting> - </section> - <section xml:id="sec-assertions-assetions"> - <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. - </para> - <programlisting language="nix"> -{ config, lib, ... }: -{ - config = lib.mkIf config.services.syslogd.enable { - assertions = - [ { assertion = !config.services.rsyslogd.enable; - message = "rsyslogd conflicts with syslogd"; - } - ]; - } -} -</programlisting> - </section> -</section> |