set up birbs website
This commit is contained in:
parent
75212dff9c
commit
56c3c4c479
8 changed files with 194 additions and 72 deletions
45
configs/services/farewellbird.nix
Normal file
45
configs/services/farewellbird.nix
Normal 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 ];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue