forked from betamike/betamike-infra
59 lines
1.5 KiB
Nix
59 lines
1.5 KiB
Nix
|
# 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;
|
||
|
};
|
||
|
|
||
|
services.matterbridge = let
|
||
|
config-file = pkgs.writeText "matterbridge.toml" ''
|
||
|
[discord.cryptic]
|
||
|
Token="${secrets.matterbridge.discord.token}"
|
||
|
Server="${secrets.matterbridge.discord.server}"
|
||
|
RemoteNickFormat="{NICK} [{PROTOCOL}]"
|
||
|
AutoWebhooks=true
|
||
|
|
||
|
[slack.cryptic]
|
||
|
Token="${secrets.matterbridge.slack.token}"
|
||
|
RemoteNickFormat="{NICK} [{PROTOCOL}]"
|
||
|
|
||
|
# [[gateway]]
|
||
|
# name="bot-test-gateway"
|
||
|
# enable=true
|
||
|
# [[gateway.inout]]
|
||
|
# account="discord.cryptic"
|
||
|
# channel="bot-test"
|
||
|
#
|
||
|
# [[gateway.inout]]
|
||
|
# account="slack.cryptic"
|
||
|
# channel="bot-test"
|
||
|
|
||
|
[[samechannelgateway]]
|
||
|
name="same-channel-gw"
|
||
|
enable = true
|
||
|
accounts = [ "slack.cryptic", "discord.cryptic" ]
|
||
|
channels = [ "bot-test", "generic-gaming", "to-the-moon-and-back" ]
|
||
|
'';
|
||
|
in {
|
||
|
enable = true;
|
||
|
configPath = "${config-file}";
|
||
|
};
|
||
|
}
|