1
0
Fork 0
nixos-config/home-manager/roles/fetch-banking-timer.nix
Malte Brandy 57123b08e1 Reformat
2022-03-08 02:42:46 +01:00

30 lines
832 B
Nix

{pkgs, ...}: {
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
${pkgs.nix}/bin/nix-shell --run "shake fetch"
if [[ "$(git status --porcelain */raw */prices)" != "" ]]; then
git add */raw
git add */prices
git commit -m "Load transactions and balances"
git push
fi
''
);
};
};
timers.fetch-banking = {
Unit.Description = "Fetch banking";
Timer.OnCalendar = "2/6:00"; # Every 6 hours from 2:00
Install.WantedBy = ["timers.target"];
};
};
}