From 730d44b26a591b4bd09180aace1014960c7a5896 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Sat, 7 Oct 2023 20:08:16 +0200 Subject: [PATCH] Fix synapse config not being optional Signed-off-by: magic_rb --- modules/services/synapse.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/services/synapse.nix b/modules/services/synapse.nix index ccabf2e..650e827 100644 --- a/modules/services/synapse.nix +++ b/modules/services/synapse.nix @@ -26,12 +26,13 @@ let makeSearchPathOutput listToAttrs mkEnableOption + optional ; configFormat = pkgs.formats.yaml {}; workerDefaults = { config, name, ... }: { - package = mkDefault cfg.main.package; + package = mkDefault cfg.package; settings = mapAttrs (_: mkDefault) { worker_replication_host = "127.0.0.1"; worker_replication_http_port = 9093; @@ -45,7 +46,7 @@ let }; mainDefaults = { config, name, ... }: { - package = pkgs.matrix-synapse; + package = mkDefault pkgs.matrix-synapse; }; instanceSubmodule = @@ -91,10 +92,10 @@ let shutdownOnExit = true; script = pkgs.writeShellScript "synapse-worker-${name}.sh" '' - ${pkgs.matrix-synapse}/bin/synapse_worker \ - ${concatStringsSep " " (flip mapAttrsToList cfg.arguments (n: v: + ${cfg.package}/bin/synapse_worker \ + ${concatStringsSep "\\\n" (flip mapAttrsToList cfg.arguments (n: v: if isList v then - concatMapStringsSep " " (x: "--${n} \"${x}\"") v + concatMapStringsSep "\\\n" (x: "--${n} \"${x}\"") v else "--${n} \"${v}\""))} ''; @@ -134,11 +135,11 @@ in "synapse-worker-${name}" (synapseService name value) - )) ++ [ + )) ++ (optional cfg.enable (nameValuePair "synapse" (synapseService "main" cfg)) - ] + ) ); }; }