2024-07-09 21:12:41 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
name = "wiki";
|
|
|
|
cfg = config.services.skynet."${name}";
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
];
|
|
|
|
|
|
|
|
options.services.skynet."${name}" = {
|
|
|
|
enable = mkEnableOption "Skynet Wiki";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.skynet.acme.domains = [
|
|
|
|
"renew.skynet.ie"
|
|
|
|
"wiki.skynet.ie"
|
|
|
|
];
|
|
|
|
|
|
|
|
services.skynet.dns.records = [
|
|
|
|
{
|
|
|
|
record = "renew";
|
|
|
|
r_type = "CNAME";
|
|
|
|
value = config.services.skynet.host.name;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
record = "wiki";
|
|
|
|
r_type = "CNAME";
|
|
|
|
value = config.services.skynet.host.name;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
virtualHosts = {
|
|
|
|
"wiki.skynet.ie" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
2024-08-12 18:32:59 +00:00
|
|
|
root = "${inputs.skynet_website_renew.defaultPackage."x86_64-linux"}/wiki";
|
2024-08-12 23:09:32 +00:00
|
|
|
# https://stackoverflow.com/a/38238001/11964934
|
|
|
|
extraConfig = ''
|
|
|
|
location / {
|
|
|
|
if ($request_uri ~ ^/(.*)\.html) {
|
|
|
|
return 302 /$1;
|
|
|
|
}
|
|
|
|
try_files $uri $uri.html $uri/ =404;
|
|
|
|
}
|
|
|
|
'';
|
2024-07-09 21:12:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# redirect old links to the new wiki
|
|
|
|
"renew.skynet.ie" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
|
|
|
locations."/".return = "307 https://wiki.skynet.ie";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|