2023-08-12 18:34:29 +02:00
|
|
|
{ config, pkgs, trucksimulatorbot, ... }:
|
2023-04-16 16:56:24 +02:00
|
|
|
let
|
2024-03-09 13:26:49 +01:00
|
|
|
domain = "trucks.${config.networking.domain}";
|
2023-04-16 16:56:24 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
services.trucksimulatorbot = {
|
2023-05-29 13:31:20 +02:00
|
|
|
enable = true;
|
|
|
|
discord = {
|
|
|
|
clientId = "831052837353816066";
|
|
|
|
publicKey = "faa7004a2a5096702f96f3ebeb45c7e8272c119b72c1a0894abc4d76d8cc8bad";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.mysql = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.mariadb;
|
|
|
|
ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "trucksimulator";
|
|
|
|
ensurePermissions = {
|
|
|
|
"trucksimulator.*" = "ALL PRIVILEGES";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
ensureDatabases = [ "trucksimulator" ];
|
2023-04-16 16:56:24 +02:00
|
|
|
};
|
2023-05-26 14:50:29 +02:00
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
"${domain}" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
2024-03-10 19:53:30 +01:00
|
|
|
locations."/invite".return = "301 https://discord.com/api/oauth2/authorize?client_id=831052837353816066&permissions=262144&scope=bot%20applications.commands";
|
2023-05-26 14:50:29 +02:00
|
|
|
locations."/" = {
|
2023-05-29 13:31:20 +02:00
|
|
|
proxyPass = "http://127.0.0.1:${toString config.services.trucksimulatorbot.listenPort}";
|
2023-05-26 14:50:29 +02:00
|
|
|
};
|
2024-03-10 19:53:30 +01:00
|
|
|
locations."/images/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${toString config.services.trucksimulatorbot.images.listenPort}/";
|
|
|
|
};
|
2023-05-29 13:54:12 +02:00
|
|
|
locations."/docs" = {
|
2023-08-12 18:34:29 +02:00
|
|
|
root = "${trucksimulatorbot.packages.x86_64-linux.docs}";
|
2023-05-29 13:54:12 +02:00
|
|
|
};
|
2023-04-16 16:56:24 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|