2024-05-03 21:50:57 +00:00
|
|
|
/*
|
|
|
|
This file is for hosting teh open governance for other societies
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
# - instead of _ for dns reasons
|
2024-05-03 23:15:20 +00:00
|
|
|
name = "open-governance";
|
2024-05-03 21:50:57 +00:00
|
|
|
|
|
|
|
cfg = config.services.skynet."${name}";
|
|
|
|
folder = "/var/skynet/${name}";
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
];
|
|
|
|
|
|
|
|
options.services.skynet."${name}" = {
|
2024-05-30 16:55:29 +00:00
|
|
|
enable = mkEnableOption "Skynet Open Governance";
|
2024-05-03 21:50:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2024-05-30 12:34:59 +00:00
|
|
|
services.skynet.acme.domains = [
|
2024-05-03 21:50:57 +00:00
|
|
|
"${name}.skynet.ie"
|
|
|
|
];
|
|
|
|
|
2024-05-30 12:25:52 +00:00
|
|
|
services.skynet.dns.records = [
|
2024-05-03 21:50:57 +00:00
|
|
|
{
|
|
|
|
record = "${name}";
|
|
|
|
r_type = "CNAME";
|
2024-05-30 16:55:29 +00:00
|
|
|
value = config.services.skynet.host.name;
|
2024-05-03 21:50:57 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
# create a folder to store the archives
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d ${folder} 0755 ${config.services.nginx.user} ${config.services.nginx.group}"
|
|
|
|
"L+ ${folder}/README.md - - - - ${./README.md}"
|
|
|
|
];
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
"${name}.skynet.ie" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
|
|
|
root = folder;
|
|
|
|
locations = {
|
|
|
|
"/".extraConfig = "autoindex on;";
|
|
|
|
|
|
|
|
# show md files as plain text
|
|
|
|
"~ \.md".extraConfig = ''
|
|
|
|
types {
|
|
|
|
text/plain md;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|