2021-11-14 22:23:34 +00:00
|
|
|
# adapted from https://nixos.org/manual/nixos/stable/index.html#module-services-matrix
|
|
|
|
{ modulesPath, config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
secrets = builtins.fromJSON (builtins.readFile ./secrets.json);
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
"${toString modulesPath}/virtualisation/digital-ocean-image.nix"
|
|
|
|
];
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.jq ];
|
|
|
|
services.openssh.enable = true;
|
|
|
|
networking.firewall.allowedTCPPorts = [ 22 80 443 ];
|
|
|
|
|
|
|
|
users.users.root.openssh.authorizedKeys.keys = [
|
|
|
|
(builtins.readFile "/home/mike/.ssh/id_mops.pub")
|
|
|
|
];
|
|
|
|
|
|
|
|
### app specific config
|
|
|
|
users.users.matterbridge = {
|
|
|
|
createHome = true;
|
|
|
|
isNormalUser = false;
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
|
2023-02-12 21:57:00 +00:00
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: prev: {
|
|
|
|
matterbridge = prev.matterbridge.overrideAttrs (oldAttrs: rec {
|
|
|
|
version = "1.26.0";
|
|
|
|
|
|
|
|
src = prev.fetchFromGitHub {
|
|
|
|
owner = "42wim";
|
|
|
|
repo = "matterbridge";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256-APlnJUu/ttK/S2AxO+SadU2ttmEnU+js/3GUf3x0aSQ=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-11-14 22:23:34 +00:00
|
|
|
services.matterbridge = let
|
|
|
|
config-file = pkgs.writeText "matterbridge.toml" ''
|
|
|
|
[discord.cryptic]
|
2023-02-12 21:57:00 +00:00
|
|
|
Token="${secrets.matterbridge.discord2.token}"
|
|
|
|
Server="${secrets.matterbridge.discord2.server}"
|
|
|
|
RemoteNickFormat="{NICK} [{PROTOCOL}]: "
|
2021-11-14 22:23:34 +00:00
|
|
|
AutoWebhooks=true
|
2023-02-12 21:57:00 +00:00
|
|
|
PreserveThreading=true
|
2021-11-14 22:23:34 +00:00
|
|
|
|
|
|
|
[slack.cryptic]
|
|
|
|
Token="${secrets.matterbridge.slack.token}"
|
2023-02-12 21:57:00 +00:00
|
|
|
RemoteNickFormat="{NICK} [{PROTOCOL}]: "
|
|
|
|
PreserveThreading=true
|
|
|
|
|
|
|
|
[matrix.wafflefarm]
|
|
|
|
Server="https://matrix.waffle.farm"
|
|
|
|
Login="${secrets.matterbridge.matrix.username}"
|
|
|
|
Password="${secrets.matterbridge.matrix.password}"
|
|
|
|
RemoteNickFormat="{NICK} [{PROTOCOL}]: "
|
|
|
|
SpoofUsername=true
|
|
|
|
PreserveThreading=true
|
|
|
|
KeepQuotedReply=false
|
|
|
|
|
|
|
|
[[gateway]]
|
|
|
|
name="testgateway"
|
|
|
|
enable=true
|
|
|
|
|
|
|
|
[[gateway.inout]]
|
|
|
|
account="matrix.wafflefarm"
|
|
|
|
channel="#bridge-test:waffle.farm"
|
|
|
|
|
|
|
|
[[gateway.inout]]
|
|
|
|
account="slack.cryptic"
|
|
|
|
channel="bridge-test"
|
2021-11-14 22:23:34 +00:00
|
|
|
|
2023-02-12 21:57:00 +00:00
|
|
|
[[gateway.inout]]
|
|
|
|
account="discord.cryptic"
|
|
|
|
channel="bridge-test"
|
2021-11-14 22:23:34 +00:00
|
|
|
|
|
|
|
[[samechannelgateway]]
|
|
|
|
name="same-channel-gw"
|
|
|
|
enable = true
|
|
|
|
accounts = [ "slack.cryptic", "discord.cryptic" ]
|
2022-03-09 01:15:53 +00:00
|
|
|
channels = [
|
|
|
|
"a-rusty-venture",
|
|
|
|
"anime",
|
|
|
|
"bossin_around",
|
|
|
|
"bot-test",
|
|
|
|
"cryptic-bunker",
|
|
|
|
"cryptic-chat",
|
2023-02-12 19:03:08 +00:00
|
|
|
"cryptic-net-public",
|
2022-03-09 01:15:53 +00:00
|
|
|
"dumbathon",
|
|
|
|
"europe",
|
|
|
|
"generic-gaming",
|
|
|
|
"get-rich-fast",
|
|
|
|
"gnv",
|
|
|
|
"golang",
|
|
|
|
"jerbs",
|
|
|
|
"main_linux",
|
|
|
|
"minecraft",
|
|
|
|
"nyc",
|
|
|
|
"omg-berks",
|
|
|
|
"sf",
|
|
|
|
"smersh",
|
|
|
|
"to-the-moon-and-back",
|
|
|
|
"travel",
|
|
|
|
"tunes"
|
|
|
|
]
|
2021-11-14 22:23:34 +00:00
|
|
|
'';
|
|
|
|
in {
|
|
|
|
enable = true;
|
|
|
|
configPath = "${config-file}";
|
|
|
|
};
|
|
|
|
}
|