From e7b1a0289c3029d539cf366365eb5ab6400c0c8c Mon Sep 17 00:00:00 2001 From: Kabbone Date: Fri, 30 Dec 2022 08:39:07 +0100 Subject: [PATCH] services: matrix add mautrix-whatsapp --- hosts/configuration_server.nix | 3 ++- modules/services/server/matrix.nix | 40 +++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/hosts/configuration_server.nix b/hosts/configuration_server.nix index 988c0c6..a47b34b 100644 --- a/hosts/configuration_server.nix +++ b/hosts/configuration_server.nix @@ -15,7 +15,7 @@ { imports = # Import window or display manager. [ - #../modules/editors/nvim # ! Comment this out on first install ! + ../modules/editors/nvim # ! Comment this out on first install ! ]; users.users.${user} = { # System User @@ -86,6 +86,7 @@ bind dig agenix.defaultPackage.x86_64-linux + ffmpeg ]; }; diff --git a/modules/services/server/matrix.nix b/modules/services/server/matrix.nix index a068b9e..29feaed 100644 --- a/modules/services/server/matrix.nix +++ b/modules/services/server/matrix.nix @@ -17,6 +17,10 @@ let return 200 '${builtins.toJSON data}'; ''; in { + environment.systemPackages = { + pkgs.mautrix-whatsapp + }; + services.nginx = { enable = true; recommendedTlsSettings = true; @@ -81,19 +85,21 @@ in { ]; }; - age.secrets."services/matrix/synapse.yml" = { - file = ../../../secrets/services/matrix/synapse.age; - owner = "matrix-synapse"; - }; - age.secrets."services/matrix/telegram-registration.yml" = { - file = ../../../secrets/services/matrix/telegram-registration.age; - owner = "matrix-synapse"; - }; - systemd.services = { matrix-synapse = { requires = [ "postgresql.service" ]; }; + mautrix-whatsapp = { + description = "Matrix <-> WhatsApp bridge"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" "postgresql.service" "matrix-synapse.service" ]; + requires = [ "postgresql.service" "matrix-synapse.service" ]; + script = "${pkgs.mautrix-whatsapp}/bin/mautrix-whatsapp --config ${config.age.secrets."services/matrix/mautrix-whatsapp.yml".path}"; + serviceConfig = { + User = "mautrix-whatsapp"; + Group = "mautrix-whatsapp"; + }; + }; }; users = { @@ -172,9 +178,25 @@ in { }; }; + age.secrets."services/matrix/synapse.yml" = { + file = ../../../secrets/services/matrix/synapse.age; + owner = "matrix-synapse"; + }; age.secrets."services/matrix/mautrix-telegram.env" = { file = ../../../secrets/services/matrix/mautrix-telegram.age; owner = "mautrix-telegram"; }; + age.secrets."services/matrix/mautrix-whatsapp.yml" = { + file = ../../../secrets/services/matrix/mautrix-whatsapp.age; + owner = "mautrix-whatsapp"; + }; + age.secrets."services/matrix/telegram-registration.yml" = { + file = ../../../secrets/services/matrix/telegram-registration.age; + owner = "matrix-synapse"; + }; + age.secrets."services/matrix/whatsapp-registration.yml" = { + file = ../../../secrets/services/matrix/whatsapp-registration.age; + owner = "matrix-synapse"; + }; }