1{2 lib,3 config,4 ...5}: let6 inherit (lib.options) mkOption;7 inherit (lib.types) listOf unspecified str;8 inherit (lib.lists) map filter;9in {10 options = {11 assertions = mkOption {12 type = listOf unspecified;13 internal = true;14 default = [];15 example = [16 {17 assertion = false;18 message = "you can't enable this for that reason";19 }20 ];21 description = ''22 This option allows modules to express conditions that must23 hold for the evaluation of the system configuration to24 succeed, along with associated error messages for the user.25 '';26 };2728 warnings = mkOption {29 internal = true;30 default = [];31 type = listOf str;32 example = ["The `foo' service is deprecated and will go away soon!"];33 description = ''34 This option allows modules to show warnings to users during35 the evaluation of the system configuration.36 '';37 };38 errors = mkOption {39 type = listOf str;40 internal = true;41 description = ''42 Similar to warnings, however build will fail if any error exists.43 '';44 };45 };46 config.errors =47 map (v: v.message)48 (filter (v: !v.assertion) config.assertions);49}