+40
nixos/doc/manual/development/assertions.section.md
+40
nixos/doc/manual/development/assertions.section.md
···+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.+Although Nix has the `abort` and `builtins.trace` [functions](https://nixos.org/nix/manual/#ssec-builtins) 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.+This example, extracted from the [`syslogd` module](https://github.com/NixOS/nixpkgs/blob/release-17.09/nixos/modules/services/logging/syslogd.nix) shows how to use `assertions`. 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.
-74
nixos/doc/manual/development/assertions.xml
-74
nixos/doc/manual/development/assertions.xml
···-<link xlink:href="https://github.com/NixOS/nixpkgs/blob/release-17.09/nixos/modules/services/logging/syslogd.nix">
+1
-1
nixos/doc/manual/development/writing-modules.xml
+1
-1
nixos/doc/manual/development/writing-modules.xml
···
+58
nixos/doc/manual/from_md/development/assertions.section.xml
+58
nixos/doc/manual/from_md/development/assertions.section.xml
···+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-assertions">+<link xlink:href="https://github.com/NixOS/nixpkgs/blob/release-17.09/nixos/modules/services/logging/syslogd.nix"><literal>syslogd</literal>