Perform a git pull daily on all repos

This commit is contained in:
coolneng 2021-03-30 12:07:20 +02:00
parent 645f1c3b52
commit 41ab42449a
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 26 additions and 0 deletions

View File

@ -91,6 +91,7 @@
./modules/datasync.nix
./modules/virtualization.nix
./modules/monitoring.nix
./modules/periodic.nix
];
}

25
modules/periodic.nix Normal file
View File

@ -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";
};
};
}