From 59f781bcf9ea5ff88006433cbe91b41c733014af Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 21 Mar 2024 23:18:01 +0100 Subject: [PATCH] mx: add timer for blog rendering Signed-off-by: Harald Hoyer --- homes/x86_64-linux/harald@mx/default.nix | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/homes/x86_64-linux/harald@mx/default.nix b/homes/x86_64-linux/harald@mx/default.nix index 0ec0cb6..f9e850e 100644 --- a/homes/x86_64-linux/harald@mx/default.nix +++ b/homes/x86_64-linux/harald@mx/default.nix @@ -31,5 +31,40 @@ xdg.enable = true; xdg.mime.enable = true; + + systemd.user.services = { + render_blog = { + Service = { + Type = "oneshot"; + Environment = { + PATH = "/run/current-system/sw/bin"; + }; + ExecStart = toString ( + pkgs.writeShellScript "render_blog.sh" '' + set -eou pipefail + DIR=/var/tmp/blog.$$ + rm -fr $DIR + mkdir -p $DIR + cd $DIR + git clone --recurse-submodules https://git.hoyer.xyz/harald/blog.git + cd blog + ./build.sh + cd /var/tmp + rm -fr $DIR + '' + ); + }; + Install.WantedBy = [ "default.target" ]; + }; + }; + + systemd.user.timers = { + render_blog = { + Timer = { + OnCalendar = "hourly"; + }; + Install.WantedBy = [ "timers.target" ]; + }; + }; }