From 62429bca082542920705fd1fc542672b8507219e Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 27 Jan 2024 20:23:03 +0100 Subject: [PATCH] fix(matrix-synapse): make sure to find element in list of config.services.matrix-synapse.settings.listeners.*.resources that sets names = "client" instead of just using the first element in the list of listeners --- hosts/nachtigall/apps/matrix/irc.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hosts/nachtigall/apps/matrix/irc.nix b/hosts/nachtigall/apps/matrix/irc.nix index 3b406645..fb2c1e07 100644 --- a/hosts/nachtigall/apps/matrix/irc.nix +++ b/hosts/nachtigall/apps/matrix/irc.nix @@ -1,7 +1,16 @@ { config, lib, pkgs, ... }: let - # Get port from first element in list of matrix-synapse listeners - synapsePort = "${toString (lib.findFirst (listener: listener.port != null) "" config.services.matrix-synapse.settings.listeners).port}"; + # 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; + 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 + ; + synapseClientPort = "${toString listenerWithClient.port}"; in { systemd.services.matrix-appservice-irc.serviceConfig.SystemCallFilter = lib.mkForce [ @@ -17,7 +26,7 @@ in settings = { homeserver = { domain = "pub.solar"; - url = "http://127.0.0.1:${synapsePort}"; + url = "http://127.0.0.1:${synapseClientPort}"; media_url = "https://matrix.pub.solar"; enablePresence = false; };