{ config, lib, ... }: let cfg = config.services.matrix-synapse; mkIntOption = description: lib.mkOption { type = lib.types.int; default = 0; description = description; }; in { imports = [ ./single/appservice.nix ./single/background.nix ./single/user-dir.nix ./auth.nix ./client-reader.nix ./federation-inbound.nix ./federation-reader.nix ./federation-sender.nix ./media-repo.nix ./pusher.nix ./sync.nix #./stream-writers/event-stream-writer.nix ]; options.services.matrix-synapse = { enableWorkers = lib.mkEnableOption "Enable dedicated workers"; 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"; authWorkers = mkIntOption "Number of auth workers"; federationSenders = mkIntOption "Number of federation senders"; pushers = mkIntOption "Number of pushers"; mediaRepoWorkers = mkIntOption "Number of media repo workers"; syncWorkers = mkIntOption "Number of sync workers"; clientReaders = mkIntOption "Number of client readers"; federationReaders = mkIntOption "Number of federation readers"; federationInboundWorkers = mkIntOption "Number of federation inbound workers"; #stream writers eventStreamWriters = mkIntOption "Number of event stream writers"; typingStreamWriters = mkIntOption "Number of typing stream writers"; toDeviceStreamWriters = mkIntOption "Number of to_device stream writers"; accountDataStreamWriters = mkIntOption "Number of account data stream writers"; receiptsStreamWriters = mkIntOption "Number of read receipt stream writers"; presenceStreamWriters = mkIntOption "Number of presence stream writers"; pushRuleStreamWriters = mkIntOption "Number of push rule stream writers"; nginxVirtualHostName = lib.mkOption { type = lib.types.str; default = null; description = "The virtual host name for the nginx server"; }; }; config = { assertions = [ { assertion = cfg.enableWorkers -> cfg.nginxVirtualHostName != null; message = "nginxVirtualHostName must be set when enableWorkers is true"; } ]; }; }