2022-12-12 14:18:40 +01:00
|
|
|
{ config, lib, ... }:
|
2022-12-07 10:14:39 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.mx-puppet-discord;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
users.groups.keys-matrix-registrations = { };
|
|
|
|
|
2024-10-14 15:46:58 +02:00
|
|
|
sops.secrets."matrix/discord/as_token" = {
|
2023-05-07 10:14:09 +02:00
|
|
|
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
2024-10-14 15:46:58 +02:00
|
|
|
key = "discord/as_token";
|
|
|
|
};
|
|
|
|
sops.secrets."matrix/discord/hs_token" = {
|
|
|
|
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
|
|
|
key = "discord/hs_token";
|
|
|
|
};
|
|
|
|
|
|
|
|
sops.templates."discord-registration.yaml" = {
|
2022-12-07 10:14:39 +01:00
|
|
|
owner = config.users.users.matrix-synapse.name;
|
|
|
|
group = config.users.groups.keys-matrix-registrations.name;
|
2024-10-14 15:46:58 +02:00
|
|
|
content = ''
|
|
|
|
as_token: "${config.sops.placeholder."matrix/discord/as_token"}"
|
|
|
|
hs_token: "${config.sops.placeholder."matrix/discord/hs_token"}"
|
|
|
|
id: discord-puppet
|
|
|
|
namespaces:
|
|
|
|
users:
|
|
|
|
- exclusive: true
|
|
|
|
regex: '@_discordpuppet_.*'
|
|
|
|
rooms: []
|
|
|
|
aliases:
|
|
|
|
- exclusive: true
|
|
|
|
regex: '#_discordpuppet_.*'
|
|
|
|
protocols: []
|
|
|
|
rate_limited: false
|
|
|
|
sender_localpart: _discordpuppet_bot
|
|
|
|
url: 'http://localhost:8434'
|
|
|
|
de.sorunome.msc2409.push_ephemeral: true
|
|
|
|
'';
|
2022-12-07 10:14:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.mx-puppet-discord = {
|
2024-10-14 15:46:58 +02:00
|
|
|
serviceConfig.SupplementaryGroups = [
|
|
|
|
config.users.groups.keys-matrix-registrations.name
|
|
|
|
];
|
2022-12-07 10:14:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
services.mx-puppet-discord.enable = true;
|
|
|
|
services.mx-puppet-discord.settings = {
|
|
|
|
bridge = {
|
|
|
|
bindAddress = "localhost";
|
|
|
|
domain = "pvv.ntnu.no";
|
2022-12-12 16:05:50 +01:00
|
|
|
homeserverUrl = "https://matrix.pvv.ntnu.no";
|
2022-12-07 10:14:39 +01:00
|
|
|
};
|
|
|
|
provisioning.whitelist = [ "@dandellion:dodsorf\\.as" "@danio:pvv\\.ntnu\\.no"];
|
|
|
|
relay.whitelist = [ ".*" ];
|
|
|
|
selfService.whitelist = [ "@danio:pvv\\.ntnu\\.no" "@dandellion:dodsorf\\.as" ];
|
|
|
|
};
|
2024-10-14 15:46:58 +02:00
|
|
|
services.mx-puppet-discord.serviceDependencies = [
|
|
|
|
"matrix-synapse.target"
|
|
|
|
"nginx.service"
|
|
|
|
];
|
2022-12-07 10:14:39 +01:00
|
|
|
|
|
|
|
|
2023-08-18 00:54:06 +02:00
|
|
|
services.matrix-synapse-next.settings = {
|
2024-10-14 15:46:58 +02:00
|
|
|
app_service_config_files = [
|
|
|
|
config.sops.templates."discord-registration.yaml".path
|
|
|
|
];
|
2023-08-18 00:54:06 +02:00
|
|
|
use_appservice_legacy_authorization = true;
|
|
|
|
};
|
2022-12-07 10:14:39 +01:00
|
|
|
|
|
|
|
}
|