NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.54k forks source link

borgbackup: periodic timers that for machines that are often suspended? #303322

Open raboof opened 5 months ago

raboof commented 5 months ago

the borgbackup jobs.<name>.startAt = "daily" settings translates to a timerConfig.OnCalendar that will perform a backup daily at exactly 00:00. However, when the machine happens to be suspended at that time, as might be common for a laptop, the backup won't happen at all on those days.

It might be interesting to have an option that does periodic backups, but also takes into account the fact that the machine might not always be on?

winterqt commented 4 months ago

This can be resolved easily by configuring the timer with Persistent = true. We can add an option to the Borg job to enable that a la system.autoUpgrade.persistent.

betalars commented 4 months ago

maybe having the persistent option true by default would also resolve this issue. I feel like the average user would want to always have that enabled.

aanderse commented 4 months ago

@betalars you make a good point here... i think that is a reasonable default value

can you please make a one line PR address this?

raboof commented 4 months ago

Nice! Until then trying this out with:

systemd.timers."borgbackup-job-home-aengelen".timerConfig.Persistent = lib.mkForce true