Setup matrix-hookshot

This commit is contained in:
Charlotte Van Petegem 2023-01-29 13:12:41 +01:00
parent 850f630a59
commit 77d5c64ff7
No known key found for this signature in database
GPG key ID: 019E764B7184435A
5 changed files with 49 additions and 0 deletions

View file

@ -7,6 +7,7 @@
}; };
config = lib.mkIf config.chvp.services.matrix.enable { config = lib.mkIf config.chvp.services.matrix.enable {
chvp.base.zfs.systemLinks = [{ path = "/var/lib/matrix-hookshot"; type = "data"; }];
chvp.services.nginx.hosts = [{ chvp.services.nginx.hosts = [{
fqdn = "matrix.vanpetegem.me"; fqdn = "matrix.vanpetegem.me";
options.locations = { options.locations = {
@ -24,6 +25,12 @@
proxy_set_header X-Forwarded-Ssl on; proxy_set_header X-Forwarded-Ssl on;
''; '';
}; };
"/_hookshot" = {
proxyPass = "http://127.0.0.1:9000";
extraConfig = ''
proxy_set_header X-Forwarded-Ssl on;
'';
};
}; };
}]; }];
@ -53,6 +60,7 @@
app_service_config_files = [ app_service_config_files = [
config.age.secrets."files/services/matrix-synapse/whatsapp-registration.yml".path config.age.secrets."files/services/matrix-synapse/whatsapp-registration.yml".path
config.age.secrets."files/services/matrix-synapse/slack-registration.yml".path config.age.secrets."files/services/matrix-synapse/slack-registration.yml".path
config.age.secrets."files/services/matrix-synapse/hookshot-registration.yml".path
]; ];
}; };
extraConfigFiles = [ extraConfigFiles = [
@ -117,6 +125,18 @@
Group = "mautrix_whatsapp"; Group = "mautrix_whatsapp";
}; };
}; };
matrix-hookshot = {
description = "Matrix <-> Services bridge";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "matrix-synapse.service" ];
requires = [ "matrix-synapse.service" ];
script = "${pkgs.matrix-hookshot}/bin/matrix-hookshot ${config.age.secrets."files/services/matrix-hookshot/config.yml".path} ${config.age.secrets."files/services/matrix-hookshot/registration.yml".path}";
serviceConfig = {
User = "matrix_hookshot";
Group = "matrix_hookshot";
WorkingDirectory = "/var/lib/matrix-hookshot";
};
};
}; };
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /var/log/mautrix-whatsapp - mautrix_whatsapp mautrix_whatsapp" "d /var/log/mautrix-whatsapp - mautrix_whatsapp mautrix_whatsapp"
@ -134,6 +154,12 @@
group = "mautrix_whatsapp"; group = "mautrix_whatsapp";
isSystemUser = true; isSystemUser = true;
}; };
matrix_hookshot = {
uid = 979;
group = "matrix_hookshot";
home = "/var/lib/matrix-hookshot";
isSystemUser = true;
};
}; };
groups = { groups = {
matrix_appservice_slack = { matrix_appservice_slack = {
@ -142,6 +168,9 @@
mautrix_whatsapp = { mautrix_whatsapp = {
gid = 997; gid = 997;
}; };
matrix_hookshot = {
gid = 979;
};
}; };
}; };
@ -153,6 +182,19 @@
file = ../../../secrets/files/services/matrix-appservice-slack/registration.yml.age; file = ../../../secrets/files/services/matrix-appservice-slack/registration.yml.age;
owner = "matrix_appservice_slack"; owner = "matrix_appservice_slack";
}; };
age.secrets."files/services/matrix-hookshot/config.yml" = {
file = ../../../secrets/files/services/matrix-hookshot/config.yml.age;
owner = "matrix_hookshot";
};
age.secrets."files/services/matrix-hookshot/registration.yml" = {
file = ../../../secrets/files/services/matrix-hookshot/registration.yml.age;
owner = "matrix_hookshot";
};
age.secrets."files/services/matrix-hookshot/passkey.pem" = {
path = "/var/lib/matrix-hookshot/passkey.pem";
file = ../../../secrets/files/services/matrix-hookshot/passkey.pem.age;
owner = "matrix_hookshot";
};
age.secrets."files/services/mautrix-whatsapp/config.yml" = { age.secrets."files/services/mautrix-whatsapp/config.yml" = {
file = ../../../secrets/files/services/mautrix-whatsapp/config.yml.age; file = ../../../secrets/files/services/mautrix-whatsapp/config.yml.age;
owner = "mautrix_whatsapp"; owner = "mautrix_whatsapp";
@ -173,5 +215,9 @@
file = ../../../secrets/files/services/mautrix-whatsapp/registration.yml.age; file = ../../../secrets/files/services/mautrix-whatsapp/registration.yml.age;
owner = "matrix-synapse"; owner = "matrix-synapse";
}; };
age.secrets."files/services/matrix-synapse/hookshot-registration.yml" = {
file = ../../../secrets/files/services/matrix-hookshot/registration.yml.age;
owner = "matrix-synapse";
};
}; };
} }

View file

@ -84,6 +84,9 @@ in
"secrets/files/services/matrix-appservice-slack/config.yml.age".publicKeys = [ lasting-integrity ] ++ users; "secrets/files/services/matrix-appservice-slack/config.yml.age".publicKeys = [ lasting-integrity ] ++ users;
"secrets/files/services/matrix-appservice-slack/registration.yml.age".publicKeys = [ lasting-integrity ] ++ users; "secrets/files/services/matrix-appservice-slack/registration.yml.age".publicKeys = [ lasting-integrity ] ++ users;
"secrets/files/services/matrix-hookshot/config.yml.age".publicKeys = [ lasting-integrity ] ++ users;
"secrets/files/services/matrix-hookshot/passkey.pem.age".publicKeys = [ lasting-integrity ] ++ users;
"secrets/files/services/matrix-hookshot/registration.yml.age".publicKeys = [ lasting-integrity ] ++ users;
"secrets/files/services/matrix-synapse/config.yml.age".publicKeys = [ lasting-integrity ] ++ users; "secrets/files/services/matrix-synapse/config.yml.age".publicKeys = [ lasting-integrity ] ++ users;
"secrets/files/services/mautrix-whatsapp/config.yml.age".publicKeys = [ lasting-integrity ] ++ users; "secrets/files/services/mautrix-whatsapp/config.yml.age".publicKeys = [ lasting-integrity ] ++ users;
"secrets/files/services/mautrix-whatsapp/registration.yml.age".publicKeys = [ lasting-integrity ] ++ users; "secrets/files/services/mautrix-whatsapp/registration.yml.age".publicKeys = [ lasting-integrity ] ++ users;

Binary file not shown.

Binary file not shown.