Merge pull request 'matrix: Import config for IRC' (#69) from feat/matrix-irc into main

Reviewed-on: pub-solar/infra#69
Reviewed-by: teutat3s <teutat3s@noreply.git.pub.solar>
This commit is contained in:
Akshay Mankar 2023-11-19 14:52:58 +00:00
commit 569bb5f875
Signed by: pub.solar gitea
GPG key ID: F0332B04B7054873
3 changed files with 116 additions and 1 deletions

View file

@ -0,0 +1,114 @@
{lib, ...}:
{
services.matrix-appservice-irc = {
enable = true;
localpart = "irc_bot";
port = 8010;
registrationUrl = "http://localhost:8010";
settings = {
homeserver = {
# TODO: Use the port from synapse config
domain = "test.pub.solar";
url = "http://127.0.0.1:8008";
media_url = "https://matrix.test.pub.solar";
enablePresence = false;
};
ircService = {
ident = {
address = "::";
enabled = false;
port = 1113;
};
logging = {
level = "debug";
maxFiles = 5;
toCosole = true;
};
matrixHandler = {
eventCacheSize = 4096;
};
metrics = {
enabled = true;
remoteUserAgeBuckets = [ "1h" "1d" "1w" ];
};
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 {
# TODO: Remove freenode if nobody uses it.
"irc.freenode.net" = lib.attrsets.recursiveUpdate commonConfig {
name = "freenode";
dynamicChannels.groupId = "+freenode.net:localhost";
# TODO: if someone uses freenode, we should specify freenode in the user display names insted of just "IRC";
matrixClients.displayName = "$NICK (IRC)";
dynamicChannels.aliasTemplate = "#irc_$CHANNEL";
matrixClients.userTemplate = "@irc_$NICK";
};
"irc.libera.chat" = lib.attrsets.recursiveUpdate commonConfig {
name = "libera";
dynamicChannels.groupId = "+libera.chat:localhost";
matrixClients.displayName = "$NICK (LIBERA-IRC)";
};
"irc.scratch-network.net" = lib.attrsets.recursiveUpdate commonConfig {
name = "scratch";
matrixClients.displayName = "$NICK (SCRATCH-IRC)";
dynamicChannels.groupId = "+scratch-network.net:localhost";
};
};
};
};
};
}

View file

@ -209,7 +209,7 @@ in {
app_service_config_files = [ app_service_config_files = [
"/var/lib/matrix-synapse/telegram-registration.yaml" "/var/lib/matrix-synapse/telegram-registration.yaml"
# "/matrix-appservice-irc-registration.yaml" "/var/lib/matrix-appservice-irc/registration.yml"
# "/matrix-appservice-slack-registration.yaml" # "/matrix-appservice-slack-registration.yaml"
# "/hookshot-registration.yml" # "/hookshot-registration.yml"
# "/matrix-mautrix-signal-registration.yaml" # "/matrix-mautrix-signal-registration.yaml"

View file

@ -27,6 +27,7 @@
./apps/matrix/mautrix-telegram.nix ./apps/matrix/mautrix-telegram.nix
./apps/matrix/synapse.nix ./apps/matrix/synapse.nix
./apps/matrix/irc.nix
./apps/nginx-matrix.nix ./apps/nginx-matrix.nix
# Override with module from nixos-unstable, needs to be added # Override with module from nixos-unstable, needs to be added