{ config, pkgs, lib, ... }: let cfg = config.services.matrix-synapse; #eventWriters = lib.range 0 (count - 1); #typingWriters = lib.range 0 (count - 1); #deviceWriters = lib.range 0 (count - 1); #accountDataWriters = lib.range 0 (count - 1); #receiptsWriters = lib.range 0 (count - 1); #presenceWriters = lib.range 0 (count - 1); #pusherWriters = lib.range 0 (count - 1); in { imports = [ ./federation-sender.nix ./appservice.nix ./pusher.nix ./stream-writers/event-stream-writer.nix ]; options.services.matrix-synapse = lib.listToAttrs (lib.map (option: { name = "${option}StreamWriters"; value = lib.mkOption { type = lib.types.int; default = 0; description = "Number of writers for ${option} streams"; }; }) [ "event" "typing" "toDevice" "accountData" "receipts" "presence" "pushRule" ]) // { enableStreamWriters = lib.mkEnableOption "Enable stream writers"; enableAppserviceWorker = lib.mkEnableOption "Enable dedicated appservice worker"; enableBackgroundWorker = lib.mkEnableOption "Enable dedicated background task worker"; federationSenders = lib.mkOption { type = lib.types.int; default = 0; description = "Number of federation senders"; }; pushers = lib.mkOption { type = lib.types.int; default = 0; description = "Number of pushers"; }; }; config = lib.mkIf cfg.enableStreamWriters { #services.matrix-synapse = { # settings = { # instance_map = lib.listToAttrs (lib.map (index: { # name = "stream-writer-${toString index}"; # value = { # path = "/run/matrix-synapse/stream-writer-${toString index}.sock"; # }; # }) federationSenders); # # stream_writers = { # events = lib.map (index: "stream-writer-events-${toString index}") federationSenders; # typing = lib.map (index: "stream-writer-typing-${toString index}") typingWriters; # to_device = lib.map (index: "stream-writer-to_device-${toString index}") deviceWriters; # account_data = lib.map (index: "stream-writer-account_data-${toString index}") accountDataWriters; # receipts = lib.map (index: "stream-writer-receipts-${toString index}") receiptsWriters; # presence = lib.map (index: "stream-writer-presence-${toString index}") presenceWriters; # push_rules = lib.map (index: "stream-writer-push_rules-${toString index}") pusherWriters; # }; # }; # # workers = lib.listToAttrs (lib.map (index: { # name = "stream-writerr-${toString index}"; # value = { # worker_app = "synapse.app.generic_worker"; # worker_listeners = [ ]; # }; # }) federationSenders); #}; }; }