From 3783b2141665d78fd9573b753eae218674046889 Mon Sep 17 00:00:00 2001 From: Richie Cahill Date: Thu, 21 Nov 2024 20:21:28 -0500 Subject: [PATCH] fixed update.nix --- common/optional/update.nix | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/common/optional/update.nix b/common/optional/update.nix index 3a0e630..0104ada 100644 --- a/common/optional/update.nix +++ b/common/optional/update.nix @@ -1,11 +1,24 @@ -{ lib, ... }: +{ lib, pkgs, ... }: { - services.autopull = { - enable = lib.mkDefault true; - repo.dotfiles = { - enable = lib.mkDefault true; - ssh-key = lib.mkDefault "/root/.ssh/id_ed25519_ghdeploy"; - path = lib.mkDefault /root/dotfiles; + systemd = { + services."autopull@dotfiles" = { + requires = [ "multi-user.target" ]; + after = [ "multi-user.target" ]; + description = "Pull the latest data for dotfiles"; + serviceConfig = { + Type = "oneshot"; + User = "root"; + WorkingDirectory = /root/dotfiles; + ExecStart = "${pkgs.git}/bin/git pull --all --prune"; + }; + }; + timers."autopull@dotfiles" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "1h"; + OnUnitActiveSec = "1h"; + Unit = "autopull@dotfiles.service"; + }; }; };