2023-09-17 19:51:08 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.services.skynet;
|
|
|
|
in {
|
2023-07-23 02:08:56 +00:00
|
|
|
imports = [
|
|
|
|
./acme.nix
|
|
|
|
./dns.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
options.services.skynet = {
|
|
|
|
host = {
|
|
|
|
ip = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2023-08-06 19:09:15 +00:00
|
|
|
skynet_acme.domains = [
|
|
|
|
# the root one is already covered by teh certificate
|
|
|
|
"2016.skynet.ie"
|
2023-08-11 00:44:04 +00:00
|
|
|
"discord.skynet.ie"
|
2023-09-28 16:11:35 +00:00
|
|
|
"public.skynet.ie"
|
2023-08-06 19:09:15 +00:00
|
|
|
];
|
|
|
|
|
2023-07-23 02:08:56 +00:00
|
|
|
skynet_dns.records = [
|
|
|
|
# means root domain, so skynet.ie
|
2023-09-17 19:51:08 +00:00
|
|
|
{
|
|
|
|
record = "@";
|
|
|
|
r_type = "A";
|
|
|
|
value = cfg.host.ip;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
record = "2016";
|
|
|
|
r_type = "CNAME";
|
|
|
|
value = cfg.host.name;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
record = "discord";
|
|
|
|
r_type = "CNAME";
|
|
|
|
value = cfg.host.name;
|
|
|
|
}
|
2023-09-27 23:26:32 +00:00
|
|
|
{
|
2023-09-28 16:11:35 +00:00
|
|
|
record = "public";
|
2023-09-27 23:26:32 +00:00
|
|
|
r_type = "CNAME";
|
|
|
|
value = cfg.host.name;
|
|
|
|
}
|
2023-07-23 02:08:56 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [80 443];
|
2023-09-16 00:35:26 +00:00
|
|
|
services.nginx = {
|
2023-07-23 02:08:56 +00:00
|
|
|
enable = true;
|
|
|
|
group = "acme";
|
|
|
|
|
|
|
|
virtualHosts = {
|
|
|
|
# main site
|
|
|
|
"skynet.ie" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
2023-09-16 00:35:26 +00:00
|
|
|
root = "${inputs.skynet_website.defaultPackage."x86_64-linux"}";
|
2023-09-04 17:03:48 +00:00
|
|
|
};
|
2023-07-23 02:08:56 +00:00
|
|
|
|
|
|
|
# archive of teh site as it was ~2012 to 2016
|
|
|
|
"2016.skynet.ie" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
2023-09-16 00:35:26 +00:00
|
|
|
root = "${inputs.skynet_website_2016.defaultPackage."x86_64-linux"}";
|
2023-07-23 02:08:56 +00:00
|
|
|
};
|
2023-08-11 00:44:04 +00:00
|
|
|
|
2023-09-27 23:26:32 +00:00
|
|
|
# a custom discord url, because we are too cheap otehrwise
|
2023-08-11 00:44:04 +00:00
|
|
|
"discord.skynet.ie" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
2023-09-18 19:13:56 +00:00
|
|
|
locations."/".return = "307 https://discord.gg/mkuKJkCuyM";
|
2023-08-11 00:44:04 +00:00
|
|
|
};
|
2023-09-27 23:26:32 +00:00
|
|
|
|
2023-09-28 16:11:35 +00:00
|
|
|
"public.skynet.ie" = {
|
2023-09-27 23:26:32 +00:00
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
2023-09-28 16:11:35 +00:00
|
|
|
root = "${inputs.compsoc_public.packages.x86_64-linux.default}";
|
2023-09-27 23:47:33 +00:00
|
|
|
locations."/".extraConfig = "autoindex on;";
|
2023-09-27 23:26:32 +00:00
|
|
|
};
|
2023-07-23 02:08:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-09-17 19:51:08 +00:00
|
|
|
}
|