factorio: auto backup the game saves
This commit is contained in:
		
							parent
							
								
									16604962ef
								
							
						
					
					
						commit
						43b501b261
					
				
					 1 changed files with 28 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue