1
0
Fork 0
nixos-config/home-manager/roles/fetch-banking-timer.nix

30 lines
832 B
Nix
Raw Normal View History

2022-03-08 01:42:46 +00:00
{pkgs, ...}: {
2021-08-16 19:04:08 +00:00
systemd.user = {
services.fetch-banking = {
Unit.Description = "Fetch banking";
Service = {
Type = "oneshot";
ExecStart = toString (
pkgs.writeShellScript "fetch-banking" ''
set -e
cd ~/git/buchhaltung
git pull
2021-09-22 17:03:17 +00:00
${pkgs.nix}/bin/nix-shell --run "shake fetch"
2021-09-22 16:01:01 +00:00
if [[ "$(git status --porcelain */raw */prices)" != "" ]]; then
2021-08-16 19:04:08 +00:00
git add */raw
2021-09-06 12:06:41 +00:00
git add */prices
2021-08-16 19:04:08 +00:00
git commit -m "Load transactions and balances"
git push
fi
''
);
};
};
timers.fetch-banking = {
Unit.Description = "Fetch banking";
2021-10-14 10:27:19 +00:00
Timer.OnCalendar = "2/6:00"; # Every 6 hours from 2:00
2022-03-08 01:42:46 +00:00
Install.WantedBy = ["timers.target"];
2021-08-16 19:04:08 +00:00
};
};
}