From 41ab42449a34bba7e591517d120fc6043bc59b77 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 30 Mar 2021 12:07:20 +0200 Subject: [PATCH] Perform a git pull daily on all repos --- configuration.nix | 1 + modules/periodic.nix | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 modules/periodic.nix diff --git a/configuration.nix b/configuration.nix index bfd8a55..7313ab3 100644 --- a/configuration.nix +++ b/configuration.nix @@ -91,6 +91,7 @@ ./modules/datasync.nix ./modules/virtualization.nix ./modules/monitoring.nix + ./modules/periodic.nix ]; } diff --git a/modules/periodic.nix b/modules/periodic.nix new file mode 100644 index 0000000..4d9a037 --- /dev/null +++ b/modules/periodic.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +{ + # Pull changes from git repos + systemd.user.services.git-pull = { + description = "Pull git repositories"; + wantedBy = [ "default.target" ]; + path = with pkgs; [ git ]; + script = '' + base_folder=/vault/code + cd "$base_folder" || exit + ls | xargs -P10 -I{} git -C {} pull --rebase + ''; + serviceConfig = { Type = "oneshot"; }; + }; + + systemd.user.timers.doom-upgrade = { + description = "Daily code update"; + wantedBy = [ "default.target" ]; + timerConfig = { + OnCalendar = "22:00:00"; + Unit = "git-pull.service"; + }; + }; +}