{ config, pkgs, lib, ... }: let cfg = config.services.matrix-synapse; in #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); { imports = [ ./appservice.nix ./background.nix ./federation-sender.nix ./pusher.nix ./user-dir.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"; enableUserDirWorker = lib.mkEnableOption "Enable dedicated user directory 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"; }; nginxVirtualHostName = lib.mkOption { type = lib.types.str; default = null; description = "The virtual host name for the nginx server"; }; }; config = { assertions = [ { assertion = cfg.enableUserDirWorker -> cfg.nginxVirtualHostName != null; message = "nginxVirtualHostName must be set when enableUserDirWorker is true"; } ]; }; }