46 lines
1006 B
Nix
46 lines
1006 B
Nix
{ services, pkgs, lib, makeBinPath, ... }:
|
|
let
|
|
domain = "lezzo.org";
|
|
lezzo_root = "/var/lib/lezzo.org";
|
|
service_name = "lezzo-pull";
|
|
network = import ./network.nix;
|
|
mkStartScript = name: pkgs.writeShellScript "${name}.sh" ''
|
|
set -euo pipefail
|
|
cd ${lezzo_root}
|
|
git pull origin master --rebase
|
|
'';
|
|
in
|
|
{
|
|
services.nginx.virtualHosts.${domain} = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
|
|
root = lezzo_root;
|
|
|
|
locations."/.git" = { return = "404"; };
|
|
};
|
|
|
|
systemd = {
|
|
services.${service_name} = {
|
|
path = [ pkgs.git ];
|
|
enable = true;
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = mkStartScript "${service_name}";
|
|
};
|
|
};
|
|
timers.${service_name} = {
|
|
wantedBy = [ "timers.target" ];
|
|
timerConfig = {
|
|
OnCalendar = "daily";
|
|
Unit = "${service_name}.service";
|
|
};
|
|
};
|
|
};
|
|
|
|
networking.extraHosts = ''
|
|
${network.architect-lan} ${domain}
|
|
${network.architect-wg} ${domain}
|
|
'';
|
|
}
|