2023-09-17 19:51:08 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
2023-10-01 02:53:53 +00:00
|
|
|
inputs,
|
2023-09-17 19:51:08 +00:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.services.skynet_games;
|
|
|
|
in {
|
2023-04-25 23:24:54 +00:00
|
|
|
imports = [
|
2023-05-24 15:39:02 +00:00
|
|
|
./dns.nix
|
2023-10-01 02:53:53 +00:00
|
|
|
./nginx.nix
|
2023-04-25 23:24:54 +00:00
|
|
|
./games/minecraft.nix
|
|
|
|
];
|
2023-05-24 15:39:02 +00:00
|
|
|
|
|
|
|
options.services.skynet_games = {
|
2023-09-17 19:51:08 +00:00
|
|
|
enable = mkEnableOption "Skynet Games";
|
2023-05-24 15:39:02 +00:00
|
|
|
|
2023-09-17 19:51:08 +00:00
|
|
|
host = {
|
|
|
|
ip = mkOption {
|
|
|
|
type = types.str;
|
2023-05-24 15:39:02 +00:00
|
|
|
};
|
|
|
|
|
2023-09-17 19:51:08 +00:00
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
};
|
2023-05-24 15:39:02 +00:00
|
|
|
|
2023-09-17 19:51:08 +00:00
|
|
|
domain = {
|
|
|
|
tld = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "ie";
|
|
|
|
};
|
2023-05-24 15:39:02 +00:00
|
|
|
|
2023-09-17 19:51:08 +00:00
|
|
|
base = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "skynet";
|
2023-05-24 15:39:02 +00:00
|
|
|
};
|
|
|
|
|
2023-09-17 19:51:08 +00:00
|
|
|
sub = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "games";
|
|
|
|
};
|
|
|
|
};
|
2023-05-24 15:39:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2023-07-16 00:53:21 +00:00
|
|
|
skynet_dns.records = [
|
|
|
|
# need a base domain
|
2023-09-17 19:51:08 +00:00
|
|
|
{
|
|
|
|
record = cfg.domain.sub;
|
|
|
|
r_type = "CNAME";
|
|
|
|
value = cfg.host.name;
|
|
|
|
}
|
2023-07-16 00:53:21 +00:00
|
|
|
];
|
2023-05-24 15:39:02 +00:00
|
|
|
|
2023-10-01 02:53:53 +00:00
|
|
|
skynet_acme.domains = [
|
|
|
|
"${cfg.domain.sub}.skynet.ie"
|
|
|
|
];
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = {
|
2024-01-31 15:43:18 +00:00
|
|
|
"${cfg.host.ip}" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
|
|
|
locations."/".return = "307 https://skynet.ie";
|
|
|
|
};
|
|
|
|
|
2023-10-01 02:53:53 +00:00
|
|
|
"${cfg.domain.sub}.skynet.ie" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
|
|
|
root = "${inputs.skynet_website_games.defaultPackage.x86_64-linux}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-05-24 15:39:02 +00:00
|
|
|
# the minecraft servers
|
|
|
|
services.skynet_games_minecraft = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
host = {
|
|
|
|
ip = cfg.host.ip;
|
|
|
|
name = cfg.domain.sub;
|
|
|
|
};
|
|
|
|
|
|
|
|
domain = {
|
|
|
|
sub = "minecraft.${cfg.domain.sub}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-09-17 19:51:08 +00:00
|
|
|
}
|