From ad0aa8b2cb774b0a72e84bc63b9589058c6c914c Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Sun, 5 Oct 2025 18:12:03 +0100 Subject: [PATCH] hosts/vps1: update mautrix configs --- hosts/vps1/matrix.nix | 51 ++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/hosts/vps1/matrix.nix b/hosts/vps1/matrix.nix index a0deb2b..610fc08 100644 --- a/hosts/vps1/matrix.nix +++ b/hosts/vps1/matrix.nix @@ -1,4 +1,5 @@ { + inputs, config, lib, pkgs, @@ -26,25 +27,25 @@ let }; matrixServerConfig."m.server" = "${matrixSubdomain}:443"; commonBridgeSettings = bridge: { - appservice = { - database = lib.mkIf usePostgresql { - type = "postgres"; - uri = "postgresql:///${bridge}?host=/run/postgresql"; - }; + database = lib.mkIf usePostgresql { + type = "postgres"; + uri = "postgresql:///${bridge}?host=/run/postgresql"; }; bridge = { - encryption = { - allow = true; - default = true; - require = true; - }; permissions = { "${serverName}" = "user"; "@jordan:${serverName}" = "admin"; }; - provisioning = { - shared_secret = "disable"; - }; + }; + encryption = { + allow = true; + default = true; + require = true; + pickle_key = + if (bridge == "mautrix-whatsapp") then "maunium.net/go/mautrix-whatsapp" else "mautrix.bridge.e2ee"; + }; + provisioning = { + shared_secret = "disable"; }; homeserver = { address = "https://${matrixSubdomain}"; @@ -61,6 +62,15 @@ let ''; in { + # Backport new options from https://github.com/NixOS/nixpkgs/pull/446155 + disabledModules = [ + "services/matrix/mautrix-whatsapp.nix" + ]; + + imports = [ + (inputs.nixpkgs-unstable + /nixos/modules/services/matrix/mautrix-whatsapp.nix) + ]; + networking.firewall.allowedTCPPorts = [ 8448 # Matrix federation ]; @@ -208,18 +218,19 @@ in services.mautrix-whatsapp = lib.mkIf bridges.whatsapp { enable = true; - settings = { - bridge = { + settings = lib.recursiveUpdate { + backfill = { + enabled = true; + max_initial_messags = 50; + }; + network = { + mute_status_broadcast = true; history_sync = { - backfill = true; max_initial_conversations = -1; - message_count = 50; request_full_sync = true; }; - mute_bridging = true; }; - } - // commonBridgeSettings "mautrix-whatsapp"; + } (commonBridgeSettings "mautrix-whatsapp"); }; environment.persistence."/persist".directories = [