1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
povSelf,
pkgs,
lib,
config,
hostConfig,
...
}:
let
inherit (lib) types;
cfg = lib.getAttrFromPath povSelf config;
in
{
options.enable = {
type = types.bool;
default = false;
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = config.modules.websites."grapevine.zaphyra.eu".enable == true;
message = "The option 'modules.websites.\"grapevine.zaphyra.eu\"' must be enabled in order to use this module.";
}
];
sops.secrets."environments/mautrixBridges/whatsapp" = { };
modules.services.mautrixBridge.whatsapp = {
enable = true;
package = pkgs.mautrix-whatsapp.override { withGoolm = true; };
serviceDependencies = [ "grapevine.service" ];
environmentFile = config.sops.secrets."environments/mautrixBridges/whatsapp".path;
settings = rec {
network = {
displayname_template = "{{or .BusinessName .PushName .Phone}} (WA)";
os_name = "Mautrix-WhatsApp (on ${homeserver.domain})";
identity_change_notices = true;
url_previews = true;
history_sync = {
request_full_sync = true;
full_sync_config.days_limit = 1000;
full_sync_config.size_mb_limit = 1024;
full_sync_config.storage_quota_mb = 1024;
};
};
homeserver.address = "http://[::1]:6167/";
homeserver.domain = "zaphyra.eu";
database.type = "sqlite3-fk-wal";
database.uri = "file:/var/lib/mautrix-whatsapp/mautrix-whatsapp.db?_txlock=immediate";
encryption.allow = true;
encryption.default = true;
encryption.pickle_key = "$MAUTRIX_PICKLE_KEY";
relay.enabled = false;
backfill.enabled = true;
backfill.max_initial_messages = 100;
# double_puppet.secrets."${homeserver.domain}" = "as_token:$MAUTRIX_DOUBLE_PUPPET_SHARED_SECRET";
appservice = {
id = "whatsapp";
address = "http://[::1]:29318/";
hostname = "[::1]";
port = 29318;
as_token = "$MAUTRIX_AS_TOKEN";
hs_token = "$MAUTRIX_HS_TOKEN";
};
bridge = {
personal_filtering_spaces = true;
permissions."${homeserver.domain}" = "admin";
cleanup_on_logout =
{
enabled = true;
}
// (lib.genAttrs [ "manual" "bad_credentials" ] (name: {
shared_has_users = "delete";
shared_no_users = "delete";
relayed = "delete";
private = "delete";
}));
};
};
};
};
}