hackens-org-configurations/machines/hackens-org/matterbridge.nix

61 lines
1.4 KiB
Nix
Raw Normal View History

2024-09-24 12:33:51 +02:00
{
pkgs,
lib,
config,
...
}:
2023-02-24 14:43:18 +01:00
let
port = 52187;
configFile = pkgs.writeText "metterbridge.toml" ''
[irc]
[irc.ulminfo]
Server="ulminfo.fr:6697" # Ou ens.wtf tu choisis.
Nick="roBOT"
UseTLS=true
Charset="utf8"
PrefixMessagesWithNick=true
RemoteNickFormat="<{NICK}> "
[mattermost]
[mattermost.merle]
WebhookBindAddress="0.0.0.0:${builtins.toString port}"
PrefixMessagesWithNick=false
RemoteNickFormat="{NICK}"
[[gateway]]
name="hackens"
enable=true
[[gateway.inout]]
account="irc.ulminfo"
channel="#hackens"
[[gateway.inout]]
account="mattermost.merle"
channel="town-square"
'';
in
{
systemd.services.matterbridge = {
description = "Matterbridge chat platform bridge";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
${pkgs.matterbridge}/bin/matterbridge -conf ${configFile}
'';
serviceConfig = {
User = "matterbridge";
Group = "matterbridge";
Restart = "always";
RestartSec = "10";
EnvironmentFile = config.age.secrets."matterbridge-env".path;
};
};
users.users.matterbridge = {
isSystemUser = true;
group = "matterbridge";
};
users.groups.matterbridge = { };
networking.firewall.allowedTCPPorts = [ port ];
}