factorio: auto backup the game saves
This commit is contained in:
parent
c39cf51646
commit
3773beab41
|
@ -1,4 +1,9 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
services.factorio = {
|
||||
enable = true;
|
||||
|
@ -15,6 +20,28 @@
|
|||
wants = [ "network-online.target" ];
|
||||
};
|
||||
|
||||
systemd.services.factorio-backup-save = {
|
||||
description = "Backup factorio saves";
|
||||
script = ''
|
||||
${lib.getExe pkgs.rsync} \
|
||||
-av \
|
||||
--chown=lelgenio \
|
||||
/var/lib/factorio/saves/default.zip \
|
||||
~lelgenio/Documentos/GameSaves/factorio_saves/space-age-$(date --iso=seconds).zip
|
||||
'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
systemd.timers.factorio-backup-save = {
|
||||
timerConfig = {
|
||||
OnCalendar = "*-*-* 18:00:00";
|
||||
Persistent = true;
|
||||
Unit = "factorio-backup-save.service";
|
||||
};
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
|
||||
age.secrets.factorio-settings = {
|
||||
file = ../../secrets/factorio-settings.age;
|
||||
mode = "777";
|
||||
|
|
Loading…
Reference in a new issue