91 lines
1.6 KiB
Nix
91 lines
1.6 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
inputs,
|
|
...
|
|
}:
|
|
with lib; let
|
|
name = "games";
|
|
cfg = config.services.skynet."${name}";
|
|
in {
|
|
imports = [
|
|
./dns.nix
|
|
./nginx.nix
|
|
./games/minecraft.nix
|
|
];
|
|
|
|
options.services.skynet."${name}" = {
|
|
enable = mkEnableOption "Skynet Games";
|
|
|
|
host = {
|
|
ip = mkOption {
|
|
type = types.str;
|
|
};
|
|
|
|
name = mkOption {
|
|
type = types.str;
|
|
};
|
|
};
|
|
|
|
domain = {
|
|
tld = mkOption {
|
|
type = types.str;
|
|
default = "ie";
|
|
};
|
|
|
|
base = mkOption {
|
|
type = types.str;
|
|
default = "skynet";
|
|
};
|
|
|
|
sub = mkOption {
|
|
type = types.str;
|
|
default = "games";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.skynet.dns.records = [
|
|
# need a base domain
|
|
{
|
|
record = cfg.domain.sub;
|
|
r_type = "CNAME";
|
|
value = cfg.host.name;
|
|
}
|
|
];
|
|
|
|
services.skynet.acme.domains = [
|
|
"${cfg.domain.sub}.skynet.ie"
|
|
];
|
|
|
|
services.nginx.virtualHosts = {
|
|
"${cfg.host.ip}" = {
|
|
forceSSL = true;
|
|
useACMEHost = "skynet";
|
|
locations."/".return = "307 https://skynet.ie";
|
|
};
|
|
|
|
"${cfg.domain.sub}.skynet.ie" = {
|
|
forceSSL = true;
|
|
useACMEHost = "skynet";
|
|
root = "${inputs.skynet_website_games.defaultPackage.x86_64-linux}";
|
|
};
|
|
};
|
|
|
|
# the minecraft servers
|
|
services.skynet.games_minecraft = {
|
|
enable = true;
|
|
|
|
host = {
|
|
ip = cfg.host.ip;
|
|
name = cfg.domain.sub;
|
|
};
|
|
|
|
domain = {
|
|
sub = "minecraft.${cfg.domain.sub}";
|
|
};
|
|
};
|
|
};
|
|
}
|