summary refs log tree commit diff
path: root/nixos/modules/services/web-apps/discourse.nix
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2021-10-03 18:06:03 +0200
committerNaïm Favier <n@monade.li>2021-10-04 12:47:20 +0200
commit2ddc335e6f32b875e14ad9610101325b306a0add (patch)
tree2a4591c137cb363a6ec09f529d587a10aa7a0bc7 /nixos/modules/services/web-apps/discourse.nix
parent330b1e08b8df4e1f0100a0a7810ec3157749e5ee (diff)
downloadnixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.gz
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.bz2
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.lz
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.xz
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.zst
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.zip
nixos/doc: clean up defaults and examples
Diffstat (limited to 'nixos/modules/services/web-apps/discourse.nix')
-rw-r--r--nixos/modules/services/web-apps/discourse.nix25
1 files changed, 13 insertions, 12 deletions
diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix
index b28e3cf0deb..c4fb7e2b316 100644
--- a/nixos/modules/services/web-apps/discourse.nix
+++ b/nixos/modules/services/web-apps/discourse.nix
@@ -33,7 +33,7 @@ in
         apply = p: p.override {
           plugins = lib.unique (p.enabledPlugins ++ cfg.plugins);
         };
-        defaultText = "pkgs.discourse";
+        defaultText = lib.literalExpression "pkgs.discourse";
         description = ''
           The discourse package to use.
         '';
@@ -45,7 +45,7 @@ in
                     config.networking.fqdn
                   else
                     config.networking.hostName;
-        defaultText = "config.networking.fqdn";
+        defaultText = lib.literalExpression "config.networking.fqdn";
         example = "discourse.example.com";
         description = ''
           The hostname to serve Discourse on.
@@ -99,7 +99,10 @@ in
       enableACME = lib.mkOption {
         type = lib.types.bool;
         default = cfg.sslCertificate == null && cfg.sslCertificateKey == null;
-        defaultText = "true, unless services.discourse.sslCertificate and services.discourse.sslCertificateKey are set.";
+        defaultText = lib.literalDocBook ''
+          <literal>true</literal>, unless <option>services.discourse.sslCertificate</option>
+          and <option>services.discourse.sslCertificateKey</option> are set.
+        '';
         description = ''
           Whether an ACME certificate should be used to secure
           connections to the server.
@@ -109,7 +112,7 @@ in
       backendSettings = lib.mkOption {
         type = with lib.types; attrsOf (nullOr (oneOf [ str int bool float ]));
         default = {};
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           {
             max_reqs_per_ip_per_minute = 300;
             max_reqs_per_ip_per_10_seconds = 60;
@@ -134,7 +137,7 @@ in
       siteSettings = lib.mkOption {
         type = json.type;
         default = {};
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           {
             required = {
               title = "My Cats";
@@ -334,10 +337,8 @@ in
         notificationEmailAddress = lib.mkOption {
           type = lib.types.str;
           default = "${if cfg.mail.incoming.enable then "notifications" else "noreply"}@${cfg.hostname}";
-          defaultText = ''
-            "notifications@`config.services.discourse.hostname`" if
-            config.services.discourse.mail.incoming.enable is "true",
-            otherwise "noreply`config.services.discourse.hostname`"
+          defaultText = lib.literalExpression ''
+            "''${if config.services.discourse.mail.incoming.enable then "notifications" else "noreply"}@''${config.services.discourse.hostname}"
           '';
           description = ''
             The <literal>from:</literal> email address used when
@@ -448,7 +449,7 @@ in
           replyEmailAddress = lib.mkOption {
             type = lib.types.str;
             default = "%{reply_key}@${cfg.hostname}";
-            defaultText = "%{reply_key}@`config.services.discourse.hostname`";
+            defaultText = lib.literalExpression ''"%{reply_key}@''${config.services.discourse.hostname}"'';
             description = ''
               Template for reply by email incoming email address, for
               example: %{reply_key}@reply.example.com or
@@ -459,7 +460,7 @@ in
           mailReceiverPackage = lib.mkOption {
             type = lib.types.package;
             default = pkgs.discourse-mail-receiver;
-            defaultText = "pkgs.discourse-mail-receiver";
+            defaultText = lib.literalExpression "pkgs.discourse-mail-receiver";
             description = ''
               The discourse-mail-receiver package to use.
             '';
@@ -484,7 +485,7 @@ in
       plugins = lib.mkOption {
         type = lib.types.listOf lib.types.package;
         default = [];
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           with config.services.discourse.package.plugins; [
             discourse-canned-replies
             discourse-github