This repository has no description
2.2 kB
75 lines
1{ pkgs, ... }:
2{
3 services.mautrix-whatsapp = {
4 enable = true;
5 registerToSynapse = true;
6 # use pure-Go olm implementation to avoid the insecure libolm dependency
7 package = pkgs.mautrix-whatsapp.override { withGoolm = true; };
8 settings = {
9 homeserver = {
10 address = "http://[::1]:8008";
11 domain = "lassul.us";
12 };
13 appservice = {
14 address = "http://127.0.0.1:29318";
15 hostname = "127.0.0.1";
16 port = 29318;
17 username_template = "whatsapp_{{.}}";
18 };
19 database = {
20 type = "postgres";
21 uri = "postgres:///mautrix-whatsapp?host=/run/postgresql";
22 };
23 # mautrix-whatsapp v2 (bridgev2 framework) splits config into multiple
24 # top-level sections: `network:` for WA-specific behavior, `matrix:` for
25 # Matrix-side behavior, `encryption:` for E2EE, `bridge:` only for
26 # generic bridge framework options.
27 network = {
28 displayname_template = "{{or .FullName .PushName .JID}} (WA)";
29 history_sync = {
30 request_full_sync = true;
31 };
32 };
33 matrix = {
34 # positive per-message confirmation: sends went undelivered silently
35 # for over a week in 2026-06 with no error surfaced to the client
36 delivery_receipts = true;
37 message_status_events = true;
38 };
39 encryption = {
40 allow = false;
41 default = false;
42 require = false;
43 };
44 bridge = {
45 personal_filtering_spaces = true;
46 permissions = {
47 "lassul.us" = "user";
48 "@lassulus:lassul.us" = "admin";
49 };
50 };
51 logging = {
52 min_level = "info";
53 writers = [
54 {
55 type = "stdout";
56 format = "pretty-colored";
57 }
58 ];
59 };
60 };
61 };
62
63 # let synapse read the appservice registration file written by the bridge
64 users.users.matrix-synapse.extraGroups = [ "mautrix-whatsapp" ];
65
66 services.postgresql = {
67 ensureDatabases = [ "mautrix-whatsapp" ];
68 ensureUsers = [
69 {
70 name = "mautrix-whatsapp";
71 ensureDBOwnership = true;
72 }
73 ];
74 };
75}