From c9d08c72e711c32795498d98bea28e014c37af7b Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 16 Jan 2023 06:20:17 +0000 Subject: [PATCH] WIP: matrix: add signal bridge --- hosts/servo/services/matrix/default.nix | 8 +++++++ hosts/servo/services/matrix/signal.nix | 32 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 hosts/servo/services/matrix/signal.nix diff --git a/hosts/servo/services/matrix/default.nix b/hosts/servo/services/matrix/default.nix index bf830d527..9bf734507 100644 --- a/hosts/servo/services/matrix/default.nix +++ b/hosts/servo/services/matrix/default.nix @@ -6,8 +6,16 @@ imports = [ ./discord-puppet.nix # ./irc.nix + ./signal.nix ]; + services.matrix-appservices = { + # configure defaults. used by e.g. ./signal.nix + homeserverUrl = "http://127.0.0.1:8008"; + homeserverDomain = "uninsane.org"; + addRegistrationFiles = true; + }; + sane.persist.sys.plaintext = [ { user = "matrix-synapse"; group = "matrix-synapse"; directory = "/var/lib/matrix-synapse"; } ]; diff --git a/hosts/servo/services/matrix/signal.nix b/hosts/servo/services/matrix/signal.nix new file mode 100644 index 000000000..8aa103f8e --- /dev/null +++ b/hosts/servo/services/matrix/signal.nix @@ -0,0 +1,32 @@ +{ ... }: +{ + services.signald.enable = true; + + # TODO: required? + # comes from + systemd.services.matrix-as-signal = { + requires = [ "signald.service" ]; + after = [ "signald.service" ]; + unitConfig = { + JoinsNamespaceOf = "signald.service"; + }; + path = [ + pkgs.ffmpeg # voice messages need `ffmpeg` + ]; + }; + + + services.matrix-appservices.services.signal = { + port = 29184; + format = "mautrix-python"; + package = pkgs.mautrix-signal; + serviceConfig = { + StateDirectory = [ "matrix-as-signal" "signald" ]; + SupplementaryGroups = [ "signald" ]; + }; + settings.signal = { + socket_path = config.services.signald.socketPath; + outgoing_attachment_dir = "/var/lib/signald/tmp"; + }; + }; +}