nixos-config/hosts/falkenstein/modules/trucksimulatorbot/default.nix
2024-05-31 14:51:58 +02:00

41 lines
1.1 KiB
Nix

{ config, pkgs, trucksimulatorbot, ... }:
let
domain = "trucks.${config.networking.domain}";
in
{
services.trucksimulatorbot = {
inherit domain;
enable = true;
discord = {
clientId = "831052837353816066";
publicKey = "faa7004a2a5096702f96f3ebeb45c7e8272c119b72c1a0894abc4d76d8cc8bad";
};
};
services.mysql = {
enable = true;
package = pkgs.mariadb;
ensureUsers = [
{
name = "trucksimulator";
ensurePermissions = {
"trucksimulator.*" = "ALL PRIVILEGES";
};
}
];
ensureDatabases = [ "trucksimulator" ];
};
# reverse_proxy unix//run/trucksimulator/app.sock
services.caddy.virtualHosts."${domain}".extraConfig = ''
redir /invite https://discord.com/api/oauth2/authorize?client_id=831052837353816066&permissions=262144&scope=bot%20applications.commands
handle /docs* {
file_server browse
root * ${trucksimulatorbot.packages.x86_64-linux.docs}
}
route /images* {
uri strip_prefix /images
reverse_proxy unix//run/trucksimulator/images.sock
}
reverse_proxy unix//run/trucksimulator/app.sock
'';
}