hackens-org-configurations/machines/hackens-org/matterbridge.nix
2024-01-12 16:19:31 +01:00

56 lines
1.4 KiB
Nix

{ pkgs, lib, config, ... }:
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 ];
}