Merge pull request #86649 from mmilata/prosody-muc-extraconfig

nixos/prosody: add MUC extraConfig + fixes
This commit is contained in:
Florian Klink 2020-05-04 11:47:45 +02:00 committed by GitHub
commit dd38a549f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View File

@ -382,6 +382,11 @@ let
default = "en"; default = "en";
description = "Default room language."; 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} https_ports = ${toLua cfg.httpsPorts}
${ cfg.extraConfig }
${lib.concatMapStrings (muc: '' ${lib.concatMapStrings (muc: ''
Component ${toLua muc.domain} "muc" Component ${toLua muc.domain} "muc"
modules_enabled = { "muc_mam"; ${optionalString muc.vcard_muc ''"vcard_muc";'' } } modules_enabled = { "muc_mam"; ${optionalString muc.vcard_muc ''"vcard_muc";'' } }
@ -809,7 +816,7 @@ in
muc_room_default_change_subject = ${toLua muc.roomDefaultChangeSubject} muc_room_default_change_subject = ${toLua muc.roomDefaultChangeSubject}
muc_room_default_history_length = ${toLua muc.roomDefaultHistoryLength} muc_room_default_history_length = ${toLua muc.roomDefaultHistoryLength}
muc_room_default_language = ${toLua muc.roomDefaultLanguage} muc_room_default_language = ${toLua muc.roomDefaultLanguage}
${ muc.extraConfig }
'') cfg.muc} '') cfg.muc}
${ lib.optionalString (cfg.uploadHttp != null) '' ${ lib.optionalString (cfg.uploadHttp != null) ''
@ -820,8 +827,6 @@ in
http_upload_path = ${toLua cfg.uploadHttp.httpUploadPath} http_upload_path = ${toLua cfg.uploadHttp.httpUploadPath}
''} ''}
${ cfg.extraConfig }
${ lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: '' ${ lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: ''
VirtualHost "${v.domain}" VirtualHost "${v.domain}"
enabled = ${boolToString v.enabled}; enabled = ${boolToString v.enabled};

View File

@ -6,6 +6,11 @@ import ../make-test-python.nix {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; }) (pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; })
]; ];
networking.extraHosts = ''
${nodes.server.config.networking.primaryIPAddress} example.com
${nodes.server.config.networking.primaryIPAddress} conference.example.com
${nodes.server.config.networking.primaryIPAddress} uploads.example.com
'';
}; };
server = { config, pkgs, ... }: { server = { config, pkgs, ... }: {
nixpkgs.overlays = [ nixpkgs.overlays = [
@ -18,6 +23,8 @@ import ../make-test-python.nix {
]; ];
networking.extraHosts = '' networking.extraHosts = ''
${config.networking.primaryIPAddress} example.com ${config.networking.primaryIPAddress} example.com
${config.networking.primaryIPAddress} conference.example.com
${config.networking.primaryIPAddress} uploads.example.com
''; '';
networking.firewall.enable = false; networking.firewall.enable = false;
services.prosody = { services.prosody = {
@ -39,6 +46,14 @@ import ../make-test-python.nix {
domain = "example.com"; domain = "example.com";
enabled = true; enabled = true;
}; };
muc = [
{
domain = "conference.example.com";
}
];
uploadHttp = {
domain = "uploads.example.com";
};
}; };
}; };
mysql = { config, pkgs, ... }: { mysql = { config, pkgs, ... }: {