56 lines
1.1 KiB
Nix
56 lines
1.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
inputs,
|
|
...
|
|
}: let
|
|
# function to create the cname record for eachs erver
|
|
create_cname = configs:
|
|
lib.lists.forEach configs (
|
|
c: {
|
|
record = "${c.address}.games";
|
|
r_type = "CNAME";
|
|
value = config.services.skynet.host.name;
|
|
}
|
|
);
|
|
|
|
# function to create the srv record
|
|
# this allows us to change the port without impacting (java) users
|
|
create_srv = configs:
|
|
lib.lists.forEach configs (c: {
|
|
record = "_minecraft._tcp.${c.address}.games.skynet.ie.";
|
|
r_type = "SRV";
|
|
value = "0 10 ${c.port} ${config.services.skynet.host.name}.skynet.ie.";
|
|
});
|
|
|
|
servers = [
|
|
{
|
|
address = "minecraft.compsoc";
|
|
port = "25518";
|
|
}
|
|
{
|
|
address = "minecraft-classic.compsoc";
|
|
port = "25518";
|
|
}
|
|
{
|
|
address = "minecraft-aged.compsoc";
|
|
port = "25519";
|
|
}
|
|
{
|
|
address = "minecraft.gsoc";
|
|
port = "25521";
|
|
}
|
|
{
|
|
address = "minecraft.phildeb";
|
|
port = "25522";
|
|
}
|
|
];
|
|
in {
|
|
imports = [
|
|
];
|
|
|
|
config = {
|
|
services.skynet.dns.records = (create_cname servers) ++ (create_srv servers);
|
|
};
|
|
}
|