about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMartin Milata <martin@martinmilata.cz>2020-05-04 00:10:33 +0200
committerMartin Milata <martin@martinmilata.cz>2020-05-04 00:10:33 +0200
commitce0c39be0b40c38e8f7927d0fb0cfabac378ea93 (patch)
treefb8b9a76e0776d3112e9d0e76d317324a44d9dbd /nixos
parent5fda26c3d0ac3f14d884d81482bd75325db683ea (diff)
downloadnixlib-ce0c39be0b40c38e8f7927d0fb0cfabac378ea93.tar
nixlib-ce0c39be0b40c38e8f7927d0fb0cfabac378ea93.tar.gz
nixlib-ce0c39be0b40c38e8f7927d0fb0cfabac378ea93.tar.bz2
nixlib-ce0c39be0b40c38e8f7927d0fb0cfabac378ea93.tar.lz
nixlib-ce0c39be0b40c38e8f7927d0fb0cfabac378ea93.tar.xz
nixlib-ce0c39be0b40c38e8f7927d0fb0cfabac378ea93.tar.zst
nixlib-ce0c39be0b40c38e8f7927d0fb0cfabac378ea93.zip
nixos/prosody: add MUC extraConfig, fix extraConfig order
Add extraConfig option for the muc submodule.

Also move the global extraConfig before all components and
virtualhosts, because the manual states:

    The configuration is divided into two parts. The first part is known as
    the "global" section. All settings here apply to the whole server, and
    are the default for all virtual hosts.

    The second half of the file is a series of VirtualHost and Component
    definitions. Settings under each VirtualHost or Component line apply
    only to that host.

Before, if at least one muc was defined, or uploadHttp enabled, the
global extraConfig would end up after "muc" or "http_upload" component
making it apply to that component only and not globally.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/prosody.nix13
1 files changed, 9 insertions, 4 deletions
diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix
index 9825613d809f..cdd341c9fb62 100644
--- a/nixos/modules/services/networking/prosody.nix
+++ b/nixos/modules/services/networking/prosody.nix
@@ -382,6 +382,11 @@ let
         default = "en";
         description = "Default room language.";
       };
+      extraConfig = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Additional MUC specific configuration";
+      };
     };
   };
 
@@ -792,6 +797,8 @@ in
 
       https_ports = ${toLua cfg.httpsPorts}
 
+      ${ cfg.extraConfig }
+
       ${lib.concatMapStrings (muc: ''
         Component ${toLua muc.domain} "muc"
             modules_enabled = { "muc_mam"; ${optionalString muc.vcard_muc ''"vcard_muc";'' } }
@@ -809,8 +816,8 @@ in
             muc_room_default_change_subject = ${toLua muc.roomDefaultChangeSubject}
             muc_room_default_history_length = ${toLua muc.roomDefaultHistoryLength}
             muc_room_default_language = ${toLua muc.roomDefaultLanguage}
-
-          '') cfg.muc}
+            ${ muc.extraConfig }
+        '') cfg.muc}
 
       ${ lib.optionalString (cfg.uploadHttp != null) ''
         Component ${toLua cfg.uploadHttp.domain} "http_upload"
@@ -820,8 +827,6 @@ in
             http_upload_path = ${toLua cfg.uploadHttp.httpUploadPath}
       ''}
 
-      ${ cfg.extraConfig }
-
       ${ lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: ''
         VirtualHost "${v.domain}"
           enabled = ${boolToString v.enabled};