From a15a93a31790ae0ecde471b5b4ef8b07bfcbfe8a Mon Sep 17 00:00:00 2001 From: Jimbo Date: Tue, 27 Aug 2024 05:14:19 -0400 Subject: [PATCH] Add a Discord/Matrix bridge --- flake.nix | 2 +- nixos/modules/secrets.nix | Bin 1615 -> 1751 bytes nixos/server.nix | 7 +++++-- nixos/server/matrix-discord.nix | 18 ++++++++++++++++++ nixos/server/synapse.nix | 7 +++++++ 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 nixos/server/matrix-discord.nix diff --git a/flake.nix b/flake.nix index fca2cf9..c9f6684 100644 --- a/flake.nix +++ b/flake.nix @@ -24,8 +24,8 @@ self, nixpkgs, nur, - blender-bin, nixos-mailserver, + blender-bin, home-manager, ... } @inputs: let diff --git a/nixos/modules/secrets.nix b/nixos/modules/secrets.nix index 27f416efcfe8e5432ae302e496b32f4b8b050371..66c57ff50b6d7d72bfbc575f848aa88da92687de 100644 GIT binary patch literal 1751 zcmV;|1}OOeM@dveQdv+`0G?pK&TLMf(Er$a)!JJBiJ5u*4qSE%{{|+2)?c<0#HK%o z^vh3ckC7qLUmL$0gq(VmSe)o5A~XWs+0B307*j7B^zK*i6HPGaVs0;I}fZaIv>aKH31(qfo2s?A|k`% zFMDCq3nP|#d2o`aN!&+|8e1r>dOntyZTpbD$E^rX=|3A`04Ju+h}JeM(&N^lq4WMl z#d_pR@<$p<3me?~MIZ;zmsb&I?2tM5W8X-|58W)ko8G+p9IIeA(>-x+NyJPO28x* zj11QH6T9^b@{i-2Tgey~umUXf&&@4Rc&5d;{9gjQ{sPwxrR!UR-pJa|v7g~nlnv@y zk2ICTuI1cFkHhid_GtF{zfIM8ekS>U2j>=#bLI6w z>+`Wzz0x^Zs$)uN``r zLSmoYwI}6ty+#8P6o~spe{3Irg(;P31~oU%xJhxIFmeuO=Wc*IX>^LWN{D-9vk}c7 z<8_()N*+1NG2(TSzypSWD+VV7g`T)6GiW^-_UDMs2V5o_rPICS25t83Ai~o2N-8UD+(nlGQyLB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cb*?*Ej NY{iHnMu-5(pVJ}aB%1&L diff --git a/nixos/server.nix b/nixos/server.nix index df3a8d2..a9f67fc 100644 --- a/nixos/server.nix +++ b/nixos/server.nix @@ -21,7 +21,6 @@ ./server/acme.nix ./server/ddclient.nix ./server/docker.nix - ./server/element.nix ./server/firewall.nix ./server/gitea.nix ./server/lemmy.nix @@ -33,10 +32,14 @@ ./server/nginx.nix ./server/owncast.nix ./server/pufferpanel.nix - ./server/synapse.nix ./server/tandoor.nix ./server/vaultwarden.nix ./server/misc.nix + + # Matrix + ./server/synapse.nix + ./server/element.nix + ./server/matrix-discord.nix ]; services.openssh.ports = [ 2222 ]; diff --git a/nixos/server/matrix-discord.nix b/nixos/server/matrix-discord.nix new file mode 100644 index 0000000..344af0e --- /dev/null +++ b/nixos/server/matrix-discord.nix @@ -0,0 +1,18 @@ +let + secrets = import ../modules/secrets.nix; +in { + services.matrix-appservice-discord = { + enable = true; + settings = { + auth = { + clientID = "${secrets.discordBotID}"; + botToken = "${secrets.discordBotToken}"; + usePrivilegedIntents = true; + }; + bridge = { + domain = "${secrets.jimDomain}"; + homeserverUrl = "https://matrix.${secrets.jimDomain}"; + }; + }; + }; +} diff --git a/nixos/server/synapse.nix b/nixos/server/synapse.nix index 1b76a42..515c763 100644 --- a/nixos/server/synapse.nix +++ b/nixos/server/synapse.nix @@ -32,6 +32,13 @@ in { require_transport_security = true; }; + # Allows a Discord/Matrix bridge, comment on first use and copy using instructions + app_service_config_files = [ + # cp /var/lib/matrix-appservice-discord/discord-registration.yaml /var/lib/matrix-synapse/ + # chown matrix-synapse:matrix-synapse /var/lib/matrix-synapse/discord-registration.yaml + "/var/lib/matrix-synapse/discord-registration.yaml" + ]; + # Disable registration without email registrations_require_3pid = [ "email" ];