1
0
Fork 0
nixos-config/home-manager/roles/fetch-banking-timer.nix
2021-10-14 12:27:19 +02:00

30 lines
836 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" ];
};
};
}