From 1276322ea92f34d659ca8e7fc0a69e92338d9d1e Mon Sep 17 00:00:00 2001 From: "Janik H." Date: Thu, 21 Mar 2024 20:08:54 +0100 Subject: [PATCH 1/4] nixos/prosody: add extraModules for capabilities --- nixos/doc/manual/release-notes/rl-2405.section.md | 2 ++ nixos/modules/services/networking/prosody.nix | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index 1a86beaba73f75..135f34ddc6409c 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -135,6 +135,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m - `unrar` was updated to v7. See [changelog](https://www.rarlab.com/unrar7notes.htm) for more information. +- `prosody` `services.prosody.muc.*.vcard_muc` was removed in favor of `services.prosody.muc.*.extraModules`. + - `k9s` was updated to v0.31. There have been various breaking changes in the config file format, check out the changelog of [v0.29](https://github.com/derailed/k9s/releases/tag/v0.29.0), [v0.30](https://github.com/derailed/k9s/releases/tag/v0.30.0) and diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix index 2952df2a10993d..4894f7d883b10e 100644 --- a/nixos/modules/services/networking/prosody.nix +++ b/nixos/modules/services/networking/prosody.nix @@ -336,10 +336,10 @@ let ''; }; - vcard_muc = mkOption { - type = types.bool; - default = true; - description = lib.mdDoc "Adds the ability to set vCard for Multi User Chat rooms"; + extraModules = mkOption { + type = types.listOf types.str; + default = [ "muc_mam" "vcard_muc" ]; + description = "Add more modules to the muc Component"; }; # Extra parameters. Defaulting to prosody default values. @@ -814,7 +814,9 @@ in ${lib.concatMapStrings (muc: '' Component ${toLua muc.domain} "muc" - modules_enabled = { "muc_mam"; ${optionalString muc.vcard_muc ''"vcard_muc";'' } } + modules_enabled = { + ${ lib.concatStringsSep "\n" (map (x: "${toLua x};") muc.extraModules)} + } name = ${toLua muc.name} restrict_room_creation = ${toLua muc.restrictRoomCreation} max_history_messages = ${toLua muc.maxHistoryMessages} From 812c2fcf47f9dada187101b9e92b3631f3296377 Mon Sep 17 00:00:00 2001 From: "Janik H." Date: Thu, 21 Mar 2024 20:13:54 +0100 Subject: [PATCH 2/4] nixos/jitsi-meet: add hack to update muc options --- .../modules/services/web-apps/jitsi-meet.nix | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/jitsi-meet.nix b/nixos/modules/services/web-apps/jitsi-meet.nix index c4505534d635e3..9ba382e8f18ede 100644 --- a/nixos/modules/services/web-apps/jitsi-meet.nix +++ b/nixos/modules/services/web-apps/jitsi-meet.nix @@ -189,6 +189,19 @@ in }; secureDomain.enable = mkEnableOption (lib.mdDoc "Authenticated room creation"); + + updateMucs = mkOption { + type = with types; attrsOf anything; + default = { }; + description = "This is a very hacky work around setting and only added because prosody muc is a list."; + example = { + "conference.jitsi.example.com".extraModules = [ + "lobby_autostart" + "muc_mam" + "vcard_muc" + ]; + }; + }; }; config = mkIf cfg.enable { @@ -205,7 +218,16 @@ in tls = mkDefault true; websocket = mkDefault true; }; - muc = [ + # the piece of code bellow looks at the domain name of the attrs in the list and updates the attrs if the domain name matches. + # this is done to allow adding/overriding settings in a convenient way + muc = lib.flatten (builtins.map (muc: + let + result = lib.mapAttrsToList ( + n: v: if muc.domain == n then (lib.recursiveUpdate muc v) else null + ) cfg.updateMucs; + in + if result == [ null ] then muc else result + ) [ { domain = "conference.${cfg.hostName}"; name = "Jitsi Meet MUC"; @@ -249,7 +271,7 @@ in storage = "memory" ''; } - ]; + ]); extraModules = [ "pubsub" "smacks" From 417ba422be256f58bf70a2d19f63feb0c0bb8a53 Mon Sep 17 00:00:00 2001 From: "Janik H." Date: Thu, 21 Mar 2024 20:35:28 +0100 Subject: [PATCH 3/4] jitsi-prosody-plugins: init at 20240318 --- .../ji/jitsi-prosody-plugins/package.nix | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 pkgs/by-name/ji/jitsi-prosody-plugins/package.nix diff --git a/pkgs/by-name/ji/jitsi-prosody-plugins/package.nix b/pkgs/by-name/ji/jitsi-prosody-plugins/package.nix new file mode 100644 index 00000000000000..79e540ffd78844 --- /dev/null +++ b/pkgs/by-name/ji/jitsi-prosody-plugins/package.nix @@ -0,0 +1,38 @@ +{ lib +, fetchFromGitHub +, stdenvNoCC +}: +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "jitsi-prosody-plugins"; + version = "20240318"; + + src = fetchFromGitHub { + owner = "jitsi-contrib"; + repo = "prosody-plugins"; + rev = "v${finalAttrs.version}"; + hash = "sha256-ZApx7Z08dr1EFL5eelFG3IrfrAOpg5JqUX6hbodGwuo="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p $out + rm LICENSE README.md */README*.md + rm -r images */docs + cp -r * $out/ + + runHook postInstall + ''; + + # nothing todo here + dontBuild = true; + dontConfigure = true; + dontFixup = true; + + meta = with lib; { + description = "Prosody plugins for Jitsi"; + homepage = "https://github.com/jitsi-contrib/prosody-plugins"; + license = lib.licenses.apsl20; + maintainers = with lib.maintainers; [ janik ]; + }; +}) From 7651bdb4038389865f6b4aa96a9389104fa5020d Mon Sep 17 00:00:00 2001 From: "Janik H." Date: Thu, 21 Mar 2024 20:44:24 +0100 Subject: [PATCH 4/4] nixosTests.jitsi-meet: test updateMucs --- nixos/tests/jitsi-meet.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/tests/jitsi-meet.nix b/nixos/tests/jitsi-meet.nix index fc6654f2c076cb..fec3bc2b69c6e3 100644 --- a/nixos/tests/jitsi-meet.nix +++ b/nixos/tests/jitsi-meet.nix @@ -11,7 +11,16 @@ import ./make-test-python.nix ({ pkgs, ... }: { services.jitsi-meet = { enable = true; hostName = "server"; + updateMucs = { "conference.jitsi.example.com".extraModules = [ + "lobby_autostart" + "muc_mam" + "vcard_muc" + ]; + }; }; + + services.prosody.extraPluginPaths = [ "${pkgs.jitsi-prosody-plugins}/lobby_autostart" ]; + services.jitsi-videobridge.openFirewall = true; networking.firewall.allowedTCPPorts = [ 80 443 ];