move sites to their own modules

This commit is contained in:
zackartz 2024-05-24 11:42:49 -04:00
parent e83f4ded85
commit 5be0c2ab5b
No known key found for this signature in database
GPG key ID: 5B53E53A9A514DBA
18 changed files with 707 additions and 654 deletions

View file

@ -0,0 +1,44 @@
{
lib,
config,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.sites.mirror;
in {
options.sites.mirror = with types; {
enable = mkBoolOpt false "Enable ArchLinux Mirror";
};
config = mkIf cfg.enable {
systemd.timers."mirror-update" = {
wantedBy = ["timers.target"];
timerConfig = {
OnBootSec = "1h";
OnUnitActiveSec = "1h";
Unit = "mirror-update.service";
};
};
systemd.services."mirror-update" = {
script = ''
${pkgs.rsync}/bin/rsync -vPa rsync://mirrors.lug.mtu.edu/archlinux/ /var/www/mirror.zackmyers.io/archlinux/
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
services.nginx.virtualHosts."mirror.zackmyers.io" = {
forceSSL = true;
enableACME = true;
root = "/var/www/mirror.zackmyers.io";
locations."/".extraConfig = ''
autoindex on;
'';
};
};
}