2024-05-08 20:57:07 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-01-27 10:19:30 +00:00
|
|
|
let
|
2024-01-27 19:23:03 +00:00
|
|
|
# Find element in list config.services.matrix-synapse.settings.listeners.*.resources
|
|
|
|
# that sets names = "client"
|
|
|
|
nameHasClient = name: name == "client";
|
|
|
|
resourceHasClient = resource: builtins.any nameHasClient resource.names;
|
2024-05-08 20:57:07 +00:00
|
|
|
listenerWithClient =
|
|
|
|
lib.findFirst (listener: builtins.any resourceHasClient listener.resources)
|
|
|
|
(throw "Found no matrix-synapse.settings.listeners.*.resources.*.names containing string client")
|
|
|
|
config.services.matrix-synapse.settings.listeners;
|
2024-01-27 19:23:03 +00:00
|
|
|
synapseClientPort = "${toString listenerWithClient.port}";
|
2024-01-27 10:19:30 +00:00
|
|
|
in
|
2023-11-19 12:59:44 +00:00
|
|
|
{
|
2024-04-26 23:44:20 +00:00
|
|
|
systemd.services.matrix-appservice-irc.serviceConfig.SystemCallFilter = lib.mkForce [
|
|
|
|
"@system-service @pkey"
|
|
|
|
"~@privileged @resources"
|
|
|
|
"@chown"
|
|
|
|
];
|
2023-11-19 12:59:44 +00:00
|
|
|
services.matrix-appservice-irc = {
|
|
|
|
enable = true;
|
|
|
|
localpart = "irc_bot";
|
|
|
|
port = 8010;
|
|
|
|
registrationUrl = "http://localhost:8010";
|
|
|
|
settings = {
|
|
|
|
homeserver = {
|
2024-05-08 17:47:47 +00:00
|
|
|
domain = "${config.pub-solar-os.networking.domain}";
|
2024-01-27 19:23:03 +00:00
|
|
|
url = "http://127.0.0.1:${synapseClientPort}";
|
2024-05-08 17:47:47 +00:00
|
|
|
media_url = "https://matrix.${config.pub-solar-os.networking.domain}";
|
2023-11-19 12:59:44 +00:00
|
|
|
enablePresence = false;
|
|
|
|
};
|
|
|
|
ircService = {
|
|
|
|
ident = {
|
|
|
|
address = "::";
|
|
|
|
enabled = false;
|
|
|
|
port = 1113;
|
|
|
|
};
|
|
|
|
logging = {
|
|
|
|
level = "debug";
|
|
|
|
maxFiles = 5;
|
|
|
|
toCosole = true;
|
|
|
|
};
|
|
|
|
matrixHandler = {
|
|
|
|
eventCacheSize = 4096;
|
|
|
|
};
|
|
|
|
metrics = {
|
|
|
|
enabled = true;
|
2024-05-08 20:57:07 +00:00
|
|
|
remoteUserAgeBuckets = [
|
|
|
|
"1h"
|
|
|
|
"1d"
|
|
|
|
"1w"
|
|
|
|
];
|
2023-11-19 12:59:44 +00:00
|
|
|
};
|
|
|
|
provisioning = {
|
|
|
|
enabled = false;
|
|
|
|
requestTimeoutSeconds = 300;
|
|
|
|
};
|
|
|
|
servers =
|
|
|
|
let
|
|
|
|
commonConfig = {
|
|
|
|
allowExpiredCerts = false;
|
|
|
|
botConfig = {
|
|
|
|
enabled = false;
|
|
|
|
joinChannelsIfNoUsers = false;
|
|
|
|
nick = "MatrixBot";
|
|
|
|
};
|
|
|
|
dynamicChannels = {
|
|
|
|
createAlias = true;
|
|
|
|
enabled = true;
|
|
|
|
federate = true;
|
|
|
|
joinRule = "public";
|
|
|
|
published = true;
|
|
|
|
};
|
|
|
|
ircClients = {
|
|
|
|
allowNickChanges = true;
|
|
|
|
concurrentReconnectLimit = 50;
|
|
|
|
idleTimeout = 10800;
|
|
|
|
lineLimit = 3;
|
|
|
|
maxClients = 30;
|
|
|
|
nickTemplate = "$DISPLAY[m]";
|
|
|
|
reconnectIntervalMs = 5000;
|
|
|
|
};
|
|
|
|
matrixClients = {
|
|
|
|
joinAttempts = -1;
|
|
|
|
};
|
|
|
|
membershipLists = {
|
|
|
|
enabled = true;
|
|
|
|
floodDelayMs = 10000;
|
|
|
|
global = {
|
|
|
|
ircToMatrix = {
|
|
|
|
incremental = true;
|
|
|
|
initial = true;
|
|
|
|
};
|
|
|
|
matrixToIrc = {
|
|
|
|
incremental = true;
|
|
|
|
initial = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
port = 6697;
|
|
|
|
privateMessages = {
|
|
|
|
enabled = true;
|
|
|
|
federate = true;
|
|
|
|
};
|
|
|
|
sasl = false;
|
|
|
|
sendConnectionMessages = true;
|
|
|
|
ssl = true;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
"irc.libera.chat" = lib.attrsets.recursiveUpdate commonConfig {
|
|
|
|
name = "libera";
|
|
|
|
dynamicChannels.groupId = "+libera.chat:localhost";
|
2024-01-07 19:15:16 +00:00
|
|
|
dynamicChannels.aliasTemplate = "#_libera_$CHANNEL";
|
2023-11-19 12:59:44 +00:00
|
|
|
matrixClients.displayName = "$NICK (LIBERA-IRC)";
|
|
|
|
};
|
|
|
|
"irc.scratch-network.net" = lib.attrsets.recursiveUpdate commonConfig {
|
|
|
|
name = "scratch";
|
|
|
|
matrixClients.displayName = "$NICK (SCRATCH-IRC)";
|
2024-01-07 19:15:16 +00:00
|
|
|
dynamicChannels.aliasTemplate = "#_scratch_$CHANNEL";
|
2023-11-19 12:59:44 +00:00
|
|
|
dynamicChannels.groupId = "+scratch-network.net:localhost";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|