From aadf95b57626895f3b70c4c0c5e9a1774ed6d53e Mon Sep 17 00:00:00 2001
From: echtnurich <ich@echtnurich.de>
Date: Thu, 23 Jan 2025 20:15:37 +0100
Subject: [PATCH] Add reload script for refreshing config during runtime

---
 config/hosts/yate/yate.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/config/hosts/yate/yate.nix b/config/hosts/yate/yate.nix
index d3ed2f9..d5e64f1 100644
--- a/config/hosts/yate/yate.nix
+++ b/config/hosts/yate/yate.nix
@@ -45,6 +45,11 @@
     };
     serviceConfig = {
       ExecStart = "${pkgs.yate}/bin/yate -c /etc/yate -e /etc/yate/share";
+      ExecReload= ''
+	${pkgs.git}/bin/git config --global --add safe.directory /var/lib/yate
+	/usr/bin/env GIT_SSH_COMMAND=\\"${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key\\" ${pkgs.git}/bin/git -C /var/lib/yate fetch --all
+	/usr/bin/env GIT_SSH_COMMAND=\\"${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key\\" ${pkgs.git}/bin/git -C /var/lib/yate reset --hard origin/main
+      '';
       Type="simple";
       Restart="always";
       User="yate";