From a7db357e544bf59ae7587152c09b93c6c6c2bf8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Tue, 22 Feb 2022 21:52:17 +0100 Subject: [PATCH] feat(radio-news): most recent commits show --- systems/makanek/radio-news.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/systems/makanek/radio-news.nix b/systems/makanek/radio-news.nix index 2bc9d53..d042c4e 100644 --- a/systems/makanek/radio-news.nix +++ b/systems/makanek/radio-news.nix @@ -1,7 +1,23 @@ { pkgs, lib, ... }: let inherit (import ) serveHtml; + remote = "https://cgit.lassul.us/stockholm"; in { services.nginx.virtualHosts."redaktion.r".locations."/".extraConfig = serveHtml pkgs; + + systemd.services.stockholm-history = { + startAt = "hourly"; + script = '' + stockholm=$(mktemp -d) + trap clean EXIT + clean() { + rm -rf "$stockholm" + } + ${pkgs.git}/bin/git clone ${remote} "$stockholm" + ${pkgs.git}/bin/git --git-dir "$stockholm"/.git log --pretty='"%s" by %an, %ar' --since "$(${pkgs.coreutils}/bin/date -I -d "yesterday")" \ + | ${pkgs.jq}/bin/jq -R '{text: ., from: now | todateiso8601, to: (now + (60 * 60)) | todateiso8601}' \ + | ${pkgs.curl}/bin/curl -Ssfd @- http://prism.r:7999/ + ''; + }; }