Runas and lezzo websites

This commit is contained in:
Giulio De Pasquale 2022-12-09 15:35:32 +01:00
parent 7a8bacb5df
commit 82ea0222f3
2 changed files with 90 additions and 0 deletions

45
hosts/architect/lezzo.nix Normal file
View File

@ -0,0 +1,45 @@
{ 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}
'';
}

45
hosts/architect/runas.nix Normal file
View File

@ -0,0 +1,45 @@
{ services, pkgs, lib, makeBinPath, ... }:
let
domain = "runas.rocks";
runas_root = "/var/lib/runas.rocks/dist";
service_name = "runas.rocks-pull";
network = import ./network.nix;
mkStartScript = name: pkgs.writeShellScript "${name}.sh" ''
set -euo pipefail
cd ${runas_root}
git pull origin master --rebase
'';
in
{
services.nginx.virtualHosts.${domain} = {
enableACME = true;
forceSSL = true;
locations."/".root = runas_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}
'';
}