{ config, ... }: let cfg = config.services.matrix-appservice-irc; bindPort = cfg.settings.ircService.mediaProxy.bindPort; upstreamUrl = "127.0.0.1:${toString bindPort}"; in { services.nginx = { enable = true; recommendedProxySettings = true; recommendedOptimisation = true; recommendedTlsSettings = true; recommendedGzipSettings = true; upstreams.matrix-irc.servers.${upstreamUrl} = { }; virtualHosts."matrix-irc.federez.net" = { enableACME = true; forceSSL = true; locations."/".proxyPass = "http://matrix-irc"; }; }; services.matrix-appservice-irc = { enable = true; registrationUrl = "http://127.0.0.1:8009"; settings = { homeserver.url = "https://matrix.federez.net"; homeserver.domain = "federez.net"; ircService.mediaProxy.publicUrl = "https://matrix-irc.federez.net/media"; ircService.servers."irc.rezosup.org" = { name = "RezoSup"; additionalAddresses = [ ]; onlyAdditionalAddresses = false; port = 6697; ssl = true; sslselfsign = true; modePowerMap = { o = 50; v = 1; }; botConfig.enabled = false; privateMessages.enabled = true; dynamicChannels = { enabled = true; groupId = "+rezosup:rezosup.net"; aliasTemplate = "$CHANNEL"; }; membershipLists = { enabled = true; global = { ircToMatrix = { initial = true; incremental = true; requireMatrixJoined = true; }; matrixToIrc = { initial = true; incremental = true; }; }; }; matrixClients = { userTemplate = "@irc_$NICK"; displayName = "$NICK"; }; ircClients = { nickTemplate = "$DISPLAY"; allowNickChanges = true; maxClients = 500; lineLimit = 10; kickOn = { channelJoinFailure = true; ircConnectionFailure = true; userQuit = true; }; }; }; logging = { level = "debug"; }; matrixHandler = { shortReplyTresholdSeconds = 30; }; }; }; }