diff --git a/profiles/servers/matrix-synapse.nix b/profiles/servers/matrix-synapse.nix index 446e028..2dc98a8 100644 --- a/profiles/servers/matrix-synapse.nix +++ b/profiles/servers/matrix-synapse.nix @@ -21,35 +21,11 @@ }]; public_baseurl = "https://balsoft.ru"; server_name = "balsoft.ru"; - app_service_config_files = [ - config.secrets-envsubst.mautrix-telegram-registration.substituted - config.secrets-envsubst.mautrix-whatsapp-registration.substituted - ]; - }; - services.postgresql.enable = true; - systemd.services.mautrix-whatsapp = { - description = "A bridge between whatsapp and matrix"; - path = with pkgs; [ coreutils mautrix-whatsapp ]; - wantedBy = [ "multi-user.target" ]; - requires = [ "matrix-synapse.service" "network-online.target" ]; - serviceConfig = { - Restart = "always"; - RestartSec = 1; - User = "mautrix-whatsapp"; - StateDirectory = "mautrix-whatsapp"; - }; - script = '' - cd /var/lib/mautrix-whatsapp - sleep 5 - mautrix-whatsapp -c ${config.secrets-envsubst.mautrix-whatsapp} - ''; - }; - users.users.mautrix-whatsapp = { - group = "mautrix-whatsapp"; - isSystemUser = true; + app_service_config_files = + [ config.secrets-envsubst.mautrix-telegram-registration.substituted ]; }; - users.groups.mautrix-whatsapp = {}; + services.postgresql.enable = true; services.mautrix-telegram = { enable = true; @@ -123,88 +99,6 @@ }; }; - secrets-envsubst.mautrix-whatsapp = { - secrets = [ "as_token" "hs_token" ]; - owner = "mautrix-whatsapp"; - template = builtins.toJSON { - appservice = { - address = "http://localhost:29318"; - as_token = "$as_token"; - bot = { - avatar = "mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr"; - displayname = "WhatsApp bridge bot"; - username = "whatsappbot"; - }; - database = { - max_idle_conns = 2; - max_open_conns = 20; - type = "sqlite3"; - uri = "mautrix-whatsapp.db"; - }; - hostname = "0.0.0.0"; - hs_token = "$hs_token"; - id = "whatsapp"; - port = 29318; - state_store_path = "./mx-state.json"; - }; - bridge = { - command_prefix = "!wa"; - connection_retry_delay = -1; - connection_timeout = 20; - contact_wait_delay = 1; - displayname_template = - "{{if .Notify}}{{.Notify}}{{else}}{{.Jid}}{{end}} (WA)"; - initial_chat_sync_count = 10; - initial_history_fill_count = 20; - invite_own_puppet_for_backfilling = true; - max_connection_attempts = 3; - permissions = { - "*" = 10; - "@balsoft:balsoft.ru" = 100; - }; - private_chat_portal_meta = false; - recovery_chat_sync_count = -1; - recovery_history_backfill = true; - report_connection_retry = true; - sync_max_chat_age = 259200; - sync_with_custom_puppets = true; - username_template = "whatsapp_{{.}}"; - }; - homeserver = { - address = "http://localhost:13748"; - domain = "balsoft.ru"; - }; - logging = { - directory = "./logs"; - file_date_format = "2006-01-02"; - file_mode = 384; - file_name_format = "{{.Date}}-{{.Index}}.log"; - print_level = "debug"; - timestamp_format = "Jan _2, 2006 15:04:05"; - }; - }; - }; - - secrets-envsubst.mautrix-whatsapp-registration = { - directory = "mautrix-whatsapp"; - secrets = [ "as_token" "hs_token" ]; - owner = "matrix-synapse"; - template = builtins.toJSON { - as_token = "$as_token"; - hs_token = "$hs_token"; - id = "whatsapp"; - namespaces = { - users = [{ - exclusive = true; - regex = "^@whatsapp_[0-9]+:balsoft.ru$"; - }]; - }; - rate_limited = false; - sender_localpart = "whatsappbot"; - url = "http://localhost:29318"; - }; - }; - systemd.services.mautrix-telegram.serviceConfig.DynamicUser = lib.mkForce false; @@ -215,7 +109,7 @@ isSystemUser = true; }; - users.groups.mautrix-telegram = {}; + users.groups.mautrix-telegram = { }; users.users.matrix-synapse.name = lib.mkForce "matrix-synapse"; } diff --git a/profiles/servers/nginx.nix b/profiles/servers/nginx.nix index 10ef5cc..054ad29 100644 --- a/profiles/servers/nginx.nix +++ b/profiles/servers/nginx.nix @@ -42,8 +42,6 @@ } // default; }; }; - security.acme = { - email = "balsoft@balsoft.ru"; - acceptTerms = true; - }; + security.acme.defaults.email = "balsoft@balsoft.ru"; + security.acme.acceptTerms = true; }