This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / configs / services / matrix / bridges / mautrix-discord.nix
2.6 kB 73 lines
1{ config, pkgs, ... }: 2{ 3 # The upstream module creates /var/lib/mautrix-discord with mode 0770 owned 4 # by mautrix-discord:mautrix-discord, while matrix-synapse only gets the 5 # `mautrix-discord-registration` supplementary group. That blocks 6 # matrix-synapse from traversing the directory to read the registration 7 # file. Granting it the `mautrix-discord` group as well lets it `chdir` in. 8 systemd.services.matrix-synapse.serviceConfig.SupplementaryGroups = [ "mautrix-discord" ]; 9 10 services.mautrix-discord = { 11 enable = true; 12 registerToSynapse = true; 13 settings = { 14 homeserver = { 15 address = "http://[::1]:8008"; 16 domain = "lassul.us"; 17 }; 18 # `settings.{homeserver,appservice,bridge,logging}` use `types.attrs` with 19 # full defaults, so this is a shallow merge — set keys override the 20 # default's same-level keys, but nested subtrees we redefine (database, 21 # bot, encryption, permissions) replace the default's subtree wholesale. 22 appservice = { 23 address = "http://127.0.0.1:29334"; 24 hostname = "127.0.0.1"; 25 port = 29334; 26 database = { 27 type = "postgres"; 28 uri = "postgres:///mautrix-discord?host=/run/postgresql"; 29 }; 30 id = "discord"; 31 bot = { 32 username = "discordbot"; 33 displayname = "Discord bridge bot"; 34 avatar = "mxc://maunium.net/nIdEykemnwdisvHbpxflpDlC"; 35 }; 36 ephemeral_events = true; 37 }; 38 bridge = { 39 username_template = "discord_{{.}}"; 40 displayname_template = "{{if .Webhook}}Webhook{{else}}{{or .GlobalName .Username}}{{if .Bot}} (bot){{end}}{{end}} (D)"; 41 delivery_receipts = false; 42 message_status_events = false; 43 encryption = { 44 allow = false; 45 default = false; 46 require = false; 47 }; 48 permissions = { 49 "lassul.us" = "user"; 50 "@lassulus:lassul.us" = "admin"; 51 }; 52 }; 53 }; 54 }; 55 56 services.postgresql = { 57 ensureDatabases = [ "mautrix-discord" ]; 58 ensureUsers = [ 59 { 60 name = "mautrix-discord"; 61 ensureDBOwnership = true; 62 } 63 ]; 64 }; 65 66 # portal mappings, sessions, tokens: losing them means relogin and every 67 # existing Matrix room orphaned 68 lass.backup.state.mautrix-discord.preBackup = '' 69 mkdir -p /var/backup/postgresql 70 ${pkgs.sudo}/bin/sudo -u postgres ${config.services.postgresql.package}/bin/pg_dump \ 71 mautrix-discord | ${pkgs.gzip}/bin/gzip > /var/backup/postgresql/mautrix-discord.sql.gz 72 ''; 73}