{ config, lib, ... }: let cfg = config.services.matrix-synapse; workerName = "background"; workerRoutes = [ ]; in { services.matrix-synapse = lib.mkIf cfg.enableBackgroundWorker { settings = { instance_map = { background = { path = "/run/matrix-synapse/${workerName}.sock"; }; }; run_background_tasks_on = workerName; }; workers = { background = { worker_app = "synapse.app.generic_worker"; worker_listeners = [ { type = "http"; path = "/run/matrix-synapse/${workerName}.sock"; resources = [ { names = [ "replication" ]; compress = false; } ]; } ]; }; }; }; }