From 1ee17f040b5a7d026d2f3412bb3ba9d8603c8b97 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 | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/homes/x86_64-linux/harald@mx/default.nix b/homes/x86_64-linux/harald@mx/default.nix index 0ec0cb6..223b6e2 100644 --- a/homes/x86_64-linux/harald@mx/default.nix +++ b/homes/x86_64-linux/harald@mx/default.nix @@ -31,5 +31,37 @@ xdg.enable = true; xdg.mime.enable = true; + + systemd.user.services = { + render_blog = { + Service = { + Type = "oneshot"; + ExecStart = toString ( + pkgs.writeShellScript "render_blog.sh" '' + set -eou pipefail + DIR=/var/tmp/blog.$$ + ${pkgs.coreutils}/bin/rm -fr $DIR + ${pkgs.coreutils}/bin/mkdir -p $DIR + cd $DIR + ${pkgs.git}/bin/git clone --recurse-submodules https://git.hoyer.xyz/harald/blog.git + cd blog + ./build.sh + cd /var/tmp + ${pkgs.coreutils}/bin/rm -fr $DIR + '' + ); + }; + Install.WantedBy = [ "default.target" ]; + }; + }; + + systemd.user.timers = { + render_blog = { + Timer = { + OnCalendar = "hourly"; + }; + Install.WantedBy = [ "timers.target" ]; + }; + }; }