1
0
Fork 0
forked from lukas/nixos-config
nixos-config/hosts/blunix/localServices/webhook.nix
pijukka d353bce576 feat: calendar-web light/dark family style, website version.json on deploy
calendar-web/style.css now matches the shared site palette (dotted
radial-gradient background, midnightblue/lightpink/ghostwhite, 0.5rem
border-radius) with light mode as default and the previous dark theme
moved under prefers-color-scheme, instead of a fixed dark-only look.

gitpull-website.sh now writes version.json (commit + deployedAt) after
each pull, feeding the update-available notification added in the
website repo (branches dev/production).
2026-07-29 20:36:09 +02:00

48 lines
1.6 KiB
Nix

{ config, pkgs, ... }:
{
# Auto-pull receiver for the statically hosted sites now served from
# blunix (website, launcher). Tailnet-only: Forgejo lives on pinix and
# reaches this over the mesh, never over the public interface.
networking.firewall.interfaces.tailscale0.allowedTCPPorts = [ 9000 ];
services.webhook = {
enable = true;
user = "drone";
group = "users";
port = 9000;
ip = config.tailnetIPs.blunix;
verbose = false;
openFirewall = false;
hooks = {
gitpull-website = {
command-working-directory = "/var/www/website";
execute-command = "/etc/scripts/gitpull-website.sh";
};
gitpull-launcher = {
command-working-directory = "/var/www/launcher";
execute-command = "/etc/scripts/gitpull-launcher.sh";
};
};
};
environment.etc."scripts/gitpull-website.sh".source =
pkgs.writeShellScript "gitpull-website.sh" ''
#!/run/current-system/sw/bin/bash
export PATH=/run/current-system/sw/bin:$PATH
/run/current-system/sw/bin/git -C /var/www/website pull
COMMIT=$(/run/current-system/sw/bin/git -C /var/www/website rev-parse HEAD)
DEPLOYED_AT=$(${pkgs.coreutils}/bin/date -u +%Y-%m-%dT%H:%M:%SZ)
printf '{"commit":"%s","deployedAt":"%s"}\n' "$COMMIT" "$DEPLOYED_AT" \
> /var/www/website/version.json
'';
environment.etc."scripts/gitpull-launcher.sh".source =
pkgs.writeShellScript "gitpull-launcher.sh" ''
#!/run/current-system/sw/bin/bash
export PATH=/run/current-system/sw/bin:$PATH
/run/current-system/sw/bin/git -C /var/www/launcher pull
'';
}