vps: enable borg backups
This commit is contained in:
		
							parent
							
								
									943deed8bd
								
							
						
					
					
						commit
						db0040dcf4
					
				
					 3 changed files with 50 additions and 0 deletions
				
			
		
							
								
								
									
										48
									
								
								sys/platforms/vps/borg.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								sys/platforms/vps/borg.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,48 @@ | |||
| { | ||||
|   config, | ||||
|   pkgs, | ||||
|   lib, | ||||
|   flakes, | ||||
|   ... | ||||
| }: { | ||||
|   services.borgbackup.jobs = { | ||||
|     rsync = { | ||||
|       paths = [ | ||||
|         "/var/lib/forgejo" | ||||
|         "/var/lib/mealie" | ||||
|         "/var/lib/trilium" | ||||
|       ]; | ||||
|       exclude = [ | ||||
|       ]; | ||||
|       user = "root"; | ||||
|       group = "root"; | ||||
|       doInit = true; | ||||
|       startAt = [ | ||||
|         "hourly" | ||||
|       ]; | ||||
|       inhibitsSleep = true; | ||||
|       persistentTimer = true; | ||||
| 
 | ||||
|       repo = "zh5777@zh5777.rsync.net:vps"; | ||||
|       encryption = { | ||||
|         mode = "repokey-blake2"; | ||||
|         passCommand = "cat /var/trust/borg/vps_passphrase"; | ||||
|       }; | ||||
|       compression = "auto,lz4"; | ||||
|       prune = { | ||||
|         keep = { | ||||
|           hourly = 24; | ||||
|           daily = 7; | ||||
|           weekly = 4; | ||||
|           monthly = 12; | ||||
|           yearly = 99; | ||||
|         }; | ||||
|       }; | ||||
|       extraArgs = [ | ||||
|         "--remote-path=borg14" | ||||
|       ]; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   environment.sessionVariables.BORG_REMOTE_PATH = "borg14"; | ||||
| } | ||||
|  | @ -15,6 +15,7 @@ with lib; { | |||
|     ./hardware-configuration.nix | ||||
|     ./srv | ||||
|     ./networkMap.nix | ||||
|     ./borg.nix | ||||
|   ]; | ||||
| 
 | ||||
|   local.sys = { | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ with lib; { | |||
|       host = "127.0.0.1"; | ||||
|       port = 8458; | ||||
|       noAuthentication = false; | ||||
|       noBackup = true; # I already backup the whole dataDir, so no need for this | ||||
|       instanceName = "posixlycorrect"; | ||||
|       dataDir = "/var/lib/trilium"; | ||||
|       nginx = { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue