nixos/applications/games.nix

71 lines
1.2 KiB
Nix
Raw Normal View History

{
config,
pkgs,
lib,
2023-10-01 02:53:53 +00:00
inputs,
...
}:
with lib; let
name = "games";
cfg = config.services.skynet."${name}";
in {
imports = [
2023-05-24 15:39:02 +00:00
./dns.nix
2023-10-01 02:53:53 +00:00
./nginx.nix
./games/minecraft.nix
];
2023-05-24 15:39:02 +00:00
options.services.skynet."${name}" = {
enable = mkEnableOption "Skynet Games";
2023-05-24 15:39:02 +00:00
domain = {
tld = mkOption {
type = types.str;
default = "ie";
};
2023-05-24 15:39:02 +00:00
base = mkOption {
type = types.str;
default = "skynet";
2023-05-24 15:39:02 +00:00
};
sub = mkOption {
type = types.str;
default = "games";
};
};
2023-05-24 15:39:02 +00:00
};
config = mkIf cfg.enable {
services.skynet.dns.records = [
# need a base domain
{
record = cfg.domain.sub;
r_type = "CNAME";
value = config.services.skynet.host.name;
}
];
2023-05-24 15:39:02 +00:00
services.skynet.acme.domains = [
2023-10-01 02:53:53 +00:00
"${cfg.domain.sub}.skynet.ie"
];
services.nginx.virtualHosts = {
"${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 = {
2023-05-24 15:39:02 +00:00
enable = true;
domain = {
sub = "minecraft.${cfg.domain.sub}";
};
};
};
}