2024-05-08 21:50:08 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
2024-05-08 21:49:37 +02:00
|
|
|
bridge_port = 9005; # netstat -nlp | grep 9005
|
2024-05-08 21:50:08 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: prev: {
|
|
|
|
matrix-appservice-discord = prev.matrix-appservice-discord.overrideAttrs (old: {
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "t2bot";
|
|
|
|
repo = "matrix-appservice-discord";
|
|
|
|
rev = "8361ca6121bf1f0902154baa538cb6d5766e477f";
|
|
|
|
hash = "sha256-oXon6pFJgqQ1uBLtsSVNH7XSOpxxJYqpW2n9cFrs3sU=";
|
|
|
|
};
|
|
|
|
patches =
|
|
|
|
(
|
|
|
|
let
|
|
|
|
oldPatches = old.patches or [ ];
|
|
|
|
in
|
|
|
|
if oldPatches == null then [ ] else oldPatches
|
|
|
|
)
|
|
|
|
++ [ ./patch_bridge_perms.patch ];
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
})
|
2024-05-08 21:49:37 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
age.secrets.matrix_discord_bridge_token.file = ../secrets/matrix_discord_bridge_token.age;
|
|
|
|
|
2024-05-08 21:50:08 +02:00
|
|
|
services.matrix-synapse-next.settings.app_service_config_files = [
|
|
|
|
"/var/lib/matrix-synapse/discord-registration.yaml"
|
|
|
|
];
|
2024-05-08 21:49:37 +02:00
|
|
|
|
|
|
|
services.matrix-appservice-discord = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
auth = {
|
|
|
|
usePrivilegedIntents = true; # typing status and stuff
|
|
|
|
};
|
|
|
|
bridge = {
|
|
|
|
enableSelfServiceBridging = true;
|
|
|
|
inherit (config.networking) domain;
|
|
|
|
homeserverUrl = "https://${config.networking.domain}";
|
|
|
|
disablePresence = true;
|
|
|
|
disableTypingNotifications = true;
|
|
|
|
};
|
2024-05-08 21:50:08 +02:00
|
|
|
# logging.console = "silly";
|
2024-05-08 21:49:37 +02:00
|
|
|
};
|
2024-05-08 21:50:08 +02:00
|
|
|
serviceDependencies = [ "matrix-synapse.target" ];
|
2024-05-08 21:49:37 +02:00
|
|
|
port = bridge_port;
|
|
|
|
localpart = "_discord_";
|
|
|
|
package = pkgs.matrix-appservice-discord;
|
|
|
|
environmentFile = config.age.secrets.matrix_discord_bridge_token.path;
|
|
|
|
};
|
|
|
|
}
|