Skip to content

Commit

Permalink
matrix: bridges are no longer containers
Browse files Browse the repository at this point in the history
  • Loading branch information
nifoc committed Aug 1, 2023
1 parent 7ba43a7 commit e55ab84
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 96 deletions.
10 changes: 0 additions & 10 deletions agenix/hosts/tanker/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@

mautrix-signal-config = {
file = ./mautrix-signal/config.age;
symlink = false;
path = "/var/lib/matrix-bridges/signal/config.yaml";
mode = "640";
owner = "1337";
group = "1337";
};

signald-environment = {
Expand All @@ -130,11 +125,6 @@

mautrix-whatsapp-config = {
file = ./mautrix-whatsapp/config.age;
symlink = false;
path = "/var/lib/matrix-bridges/whatsapp/config.yaml";
mode = "640";
owner = "1337";
group = "1337";
};

weewx-config = {
Expand Down
Binary file modified agenix/hosts/tanker/mautrix-signal/config.age
Binary file not shown.
Binary file modified agenix/hosts/tanker/mautrix-whatsapp/config.age
Binary file not shown.
18 changes: 9 additions & 9 deletions agenix/hosts/tanker/signald/environment.age
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
age-encryption.org/v1
-> ssh-ed25519 MtGp6g TjcF9u1gbYjURFImt7uh+O7hNw3E2pR6H/i8Xd90DkU
wdeuBiwP0BTzMeVx+i7+jpWFaAW+dMnsXakFenPad/E
-> ssh-ed25519 iO8/4g V/BUJLff8IK0g5UFXqJ5ftK6Fs8zpheFr4ETzKQd5xs
0hzEB9qG6VX878t7tZzfjyH2BkgAhl+uDR4jX9chwgY
-> g.G-grease X;7X` 3ecO{T|m
/2RKLQzMCznCQXYnltmy7YhoXzHRJ4oxdArYCfQzJEcWDwy465xgm8EMNdu0mNA+
O15n2g
--- C896AcFfLEvwf3tcYqZP5dfPKFmE4oaaKH6KveEao6A
'��{�3��*v�䖋�Ѷ4��ޫ���<�;��QC(�b-� `.�go���n�˲< >:��l0�ԑ�]T⵽ 2Δ*��h���%�l�*W�A ��O(���屄W�R�A0[��_H�C��6`
-> ssh-ed25519 MtGp6g /N1cHH7SmlpEdvKEcMzVflInTXChp+eWJFU2RoPWMUk
7nLndAtQ3DWXYmPvwq9tDPBiPLJMuDuCRtSXdFveSoo
-> ssh-ed25519 iO8/4g WSUXe/SRWLMN23PWyOM7qOCbXOFvTrzmTcq0zW/ABFs
NmQoYqT0x6t0WByQrIg+OAvP4VUU5tVydAHfVTZvPUE
-> eo6mwb;-grease :nS'C`f ?/iI)
oQ4Y4ksapQU8WwrdzObrSTiUiS37dk+c180046s7BqC6GX8iXFjR9kQSPb6tR9bl
Nhh/zHwzdGQmy7VekRL8ZdpbUeKd5D6X7w
--- aHWIb4WJ+O2kXUGFczOA6ngejy6jkMOmrFmcKLllq8s
*?DG��L5����Bf&AH�;��a�s��%1�h1rdO���&�q"D�`CQ�5���x�q���2���_�[g����Dd��'+�g�)6n��/�*,�;lxS;R[����c� �(
54 changes: 0 additions & 54 deletions container/matrix/default.nix

This file was deleted.

18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions home/programs/nvim/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ in
};
comment-nvim = buildVimPluginFrom2Nix {
pname = "comment.nvim";
version = "2023-06-12";
version = "2023-08-01";
src = fetchFromGitHub {
owner = "numtostr";
repo = "comment.nvim";
rev = "176e85eeb63f1a5970d6b88f1725039d85ca0055";
sha256 = "0y3zhv82hi8avxhmp1c9h0r17kfclwxphzyk7701f6wjky375ksw";
rev = "bacbed6346d1c5a095897f3fde3451a9a08e7f7d";
sha256 = "19s2kmflga4v0dqwjb79imbv4aa4hcck340159rbzdb8a3bfhrji";
fetchSubmodules = false;
};
};
Expand Down
3 changes: 1 addition & 2 deletions system/hosts/tanker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ in

../nixos/rimgo.nix

../nixos/synapse.nix
../nixos/matrix

../nixos/tailscale.nix

../nixos/websites-tanker.nix

../../container/matrix
../../container/proxitok
../../container/weewx
];
Expand Down
7 changes: 7 additions & 0 deletions system/nixos/matrix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
imports = [
./synapse.nix
./mautrix-whatsapp.nix
./mautrix-signal.nix
];
}
39 changes: 39 additions & 0 deletions system/nixos/matrix/mautrix-signal.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ pkgs, config, ... }:

{
services.signald.enable = true;
systemd.services.signald.serviceConfig.EnvironmentFile = [
config.age.secrets.signald-environment.path
];

systemd.services.mautrix-signal = {
description = "A Matrix-Signal puppeting bridge";
wantedBy = [ "multi-user.target" ];
requires = [ "matrix-synapse.service" "signald.service" ];
after = [ "matrix-synapse.service" "signald.service" ];
restartTriggers = [ "${config.age.secrets.mautrix-signal-config.file}" ];
serviceConfig = {
User = config.services.signald.user;
Group = config.services.signald.group;
LoadCredential = [ "config:${config.age.secrets.mautrix-signal-config.path}" ];
ExecStart = "${pkgs.mautrix-signal}/bin/mautrix-signal --config=%d/config --no-update";
Restart = "on-failure";
RestartSec = "5s";

StateDirectory = "mautrix-signal";
RuntimeDirectory = "mautrix-signal";
StateDirectoryMode = "0750";
RuntimeDirectoryMode = "0750";

ProtectHome = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectControlGroups = true;
PrivateTmp = true;
};
};

services.matrix-synapse.settings.app_service_config_files = [
"/var/lib/matrix-synapse/bridges/registration-signal.yaml"
];
}
30 changes: 30 additions & 0 deletions system/nixos/matrix/mautrix-whatsapp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ pkgs, config, ... }:

{
systemd.services.mautrix-whatsapp = {
description = "Matrix <-> Whatsapp hybrid puppeting/relaybot bridge";
wantedBy = [ "multi-user.target" ];
requires = [ "matrix-synapse.service" ];
after = [ "matrix-synapse.service" ];
restartTriggers = [ "${config.age.secrets.mautrix-whatsapp-config.file}" ];
serviceConfig = {
DynamicUser = true;
StateDirectory = "mautrix-whatsapp";
LoadCredential = [ "config:${config.age.secrets.mautrix-whatsapp-config.path}" ];
ExecStart = "${pkgs.mautrix-whatsapp}/bin/mautrix-whatsapp --config=%d/config --no-update";
Restart = "on-failure";
RestartSec = "5s";

ProtectSystem = "strict";
ProtectHome = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectControlGroups = true;
PrivateTmp = true;
};
};

services.matrix-synapse.settings.app_service_config_files = [
"/var/lib/matrix-synapse/bridges/registration-whatsapp.yaml"
];
}
11 changes: 2 additions & 9 deletions system/nixos/synapse.nix → system/nixos/matrix/synapse.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ in

listeners = [
{
bind_addresses = [ "127.0.0.1" "10.88.0.1" ];
bind_addresses = [ "127.0.0.1" ];
port = 8008;
tls = false;
type = "http";
Expand Down Expand Up @@ -81,11 +81,6 @@ in
enable_metrics = false;
report_stats = false;

app_service_config_files = [
"/var/lib/matrix-bridges/signal/registration.yaml"
"/var/lib/matrix-bridges/whatsapp/registration.yaml"
];

experimental_features = {
msc3202_device_masquerading = true;
msc3202_transaction_extensions = true;
Expand All @@ -107,9 +102,7 @@ in
};
};

systemd.services.matrix-synapse.after = [ "postgresql.service" "podman-wait-for-host-interface.service" ];

networking.firewall.interfaces."podman+".allowedTCPPorts = [ 8008 ];
systemd.services.matrix-synapse.after = [ "postgresql.service" ];

services.nginx.virtualHosts."${fqdn}" = {
quic = true;
Expand Down

0 comments on commit e55ab84

Please sign in to comment.