alpine: refactor mautrix

This commit is contained in:
Tristan 2024-04-28 11:35:37 +01:00
parent 7ad8d52e78
commit 140a50310e
6 changed files with 66 additions and 58 deletions

View file

@ -0,0 +1,29 @@
{config, ...}: let
inherit (config) sops;
inherit (sops) templates placeholder;
inherit (import ./lib.nix) toAppRegistration;
in {
sops.secrets = {
"mautrix-instagram/as_token" = {};
"mautrix-instagram/hs_token" = {};
};
sops.templates = {
"mautrix-instagram/appservice.yaml" = {
owner = "matrix-synapse";
content = toAppRegistration {
id = "instagram";
port = 29328;
as_token = placeholder."mautrix-instagram/as_token";
hs_token = placeholder."mautrix-instagram/hs_token";
sender_localpart = "Gx8tLTHsxVlrdD3qibaPdaP9t7GhfciV";
"de.sorunome.msc2409.push_ephemeral" = true;
};
};
};
# mautrix-instagram server currently in ansible/podman
services.matrix-synapse.settings.app_service_config_files = [
templates."mautrix-instagram/appservice.yaml".path
];
}

View file

@ -0,0 +1,27 @@
{
toAppRegistration = {
port,
id,
as_token,
hs_token,
sender_localpart,
rate_limited ? false,
...
} @ conf:
builtins.toJSON ({
namespaces = {
users = [
{
exclusive = true;
regex = "^@${id}_.*:tristans.cloud$";
}
{
exclusive = true;
regex = "^@${id}bot:tristans.cloud$";
}
];
};
url = "http://localhost:${toString port}";
}
// conf);
}

View file

@ -1,33 +1,7 @@
{config, ...}: let
inherit (config) sops;
inherit (sops) templates placeholder;
toAppRegistration = {
port,
id,
as_token,
hs_token,
sender_localpart,
rate_limited ? false,
...
} @ conf:
builtins.toJSON ({
namespaces = {
users = [
{
exclusive = true;
regex = "^@${id}_.*:tristans.cloud$";
}
{
exclusive = true;
regex = "^@${id}bot:tristans.cloud$";
}
];
};
url = "http://localhost:${toString port}";
}
// conf);
port = 29328;
inherit (import ./lib.nix) toAppRegistration;
in {
sops.secrets = {
"mautrix-signal/as_token" = {};
@ -38,7 +12,7 @@ in {
owner = "matrix-synapse";
content = toAppRegistration {
id = "signal";
port = port;
port = 29328;
as_token = placeholder."mautrix-signal/as_token";
hs_token = placeholder."mautrix-signal/hs_token";
sender_localpart = "Gx8tLTHsxVlrdD3qibaPdaP9t7GhfciV";

View file

@ -1,32 +1,7 @@
{config, ...}: let
inherit (config) sops;
inherit (sops) templates placeholder;
toAppRegistration = {
port,
id,
as_token,
hs_token,
sender_localpart,
rate_limited ? false,
...
} @ conf:
builtins.toJSON ({
namespaces = {
users = [
{
exclusive = true;
regex = "^@${id}_.*:tristans.cloud$";
}
{
exclusive = true;
regex = "^@${id}bot:tristans.cloud$";
}
];
};
url = "http://localhost:${toString port}";
}
// conf);
inherit (import ./lib.nix) toAppRegistration;
in {
sops.secrets = {
"mautrix-whatsapp/as_token" = {};