{ 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 ./client-reader.nix ./federation-sender.nix ./media-repo.nix ./pusher.nix ./sync.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"; }; mediaRepoWorkers = lib.mkOption { type = lib.types.int; default = 0; description = "Number of media repo workers"; }; syncWorkers = lib.mkOption { type = lib.types.int; default = 0; description = "Number of sync workers"; }; clientReaders = lib.mkOption { type = lib.types.int; default = 0; description = "Number of client readers"; }; 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"; } ]; }; }