Matrix-Synapse
Synapse is a Matrix homeserver. Matrix is an open network for secure, decentralised communication.
View the synix NixOS module on Forgejo.
References
Setup
DNS
Make sure you have a CNAME record for turn pointing to your machine running Coturn.
The fqdn is set by services.coturn.realm.
Sops
Provide the following entries to your secrets.yaml:
Generate the livekit key with:Replace
abc123with your actual secret(s)
Config
Coturn has its own module, making it easy to outsource to a small VPS with a static IPv4 address.
If you do so, both machines need the secret coturn/static-auth-secret.
In the following example, both services run on the same machine:
{
imports = [
inputs.synix.nixosModules.coturn
inputs.synix.nixosModules.matrix-synapse
];
networking.domain = "example.tld";
services.coturn = {
enable = true;
sops = true;
openFirewall = true;
};
services.matrix-synapse = {
enable = true;
sops = true;
coturn.enable = true;
# see below
bridges = {
whatsapp = {
enable = true;
admin = "@you:example.tld";
};
signal = {
enable = true;
admin = "@you:example.tld";
};
};
};
# You only need this if you want to use bridges
nixpkgs.config.permittedInsecurePackages = [
"olm-3.2.16"
];
}
Bridges
Warning: Bridges use
mautrix-gowhich relies on deprecatedlibolm.
Sops
Provide the following entries to your secrets.yaml:
Replace
abc123with your actual secret(s) andBRIDGEwith the name of your bridge (e.g.,signal)
mautrix-BRIDGE:
encryption-pickle-key: abc123
provisioning-shared-secret: abc123
public-media-signing-key: abc123
direct-media-server-key: abc123
Generate the secrets with:
NixOS configuration
The config.yaml for each bridge is managed through services.mautrix-BRIDGE.settings:
- services.mautrix-signal.settings: Generate an example config with:
mautrix-signal -c signal.yaml --generate-example-config - services.mautrix-whatsapp.settings: Generate an example config with:
mautrix-whatsapp -c whatsapp.yaml --generate-example-config
Authentication
- Open chat with bridge bot:
@BOT:DOMAIN.TLD- WhatsApp:
whatsappbot - Signal:
signalbot
- WhatsApp:
- Send:
login qr - Scan QR code
- Switch puppets:
login-matrix ACCESS_TOKEN- Get your token with: Settings > Help & About > Advanced > Access Token
Administration
Register users
Troubleshooting
Bridges: Specified admin user is not an admin in portal rooms
There seems to be a bug that the user specified under services.matrix-synapse.bridges.whatsapp.admin does not have admin permissions in portal rooms. You can set the power level manually inside each portal room: