set up birbs website

This commit is contained in:
CDaut 2025-11-24 18:27:08 +01:00
parent 75212dff9c
commit 56c3c4c479
Signed by: clara
GPG key ID: 223391B52FAD4463
8 changed files with 194 additions and 72 deletions

View file

@ -0,0 +1,45 @@
{ lib, pkgs, config, inputs, ... }:
let
repoDir = "/var/www/site";
in
{
services.nginx =
{
enable = true;
virtualHosts =
{
"farewellbird.de" = {
locations."/" = {
root = repoDir;
};
};
};
};
systemd.timers."clone-repo" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "10s";
OnUnitActiveSec = "5m";
Unit = "clone-repo.service";
};
};
systemd.services."clone-repo" = {
script = ''
set -eu
if test -d ${repoDir}; then
cd ${repoDir}
${pkgs.git}/bin/git pull
else
mkdir mkdir -p $(dirname ${repoDir})
${pkgs.git}/bin/git clone -b pages https://codeberg.org/YourLocalFops/farewellbird.git ${repoDir}
fi
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
networking.firewall.allowedTCPPorts = [ 80 ];
}