forked from jan-leila/nix-config
		
	added syncthing configDir to persistence
This commit is contained in:
		
							parent
							
								
									eb13447136
								
							
						
					
					
						commit
						2a81195563
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		|  | @ -4,6 +4,7 @@ | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   mountDir = "/mnt/sync"; |   mountDir = "/mnt/sync"; | ||||||
|  |   configDir = "/etc/syncthing"; | ||||||
| in { | in { | ||||||
|   options.host.sync = { |   options.host.sync = { | ||||||
|     enable = lib.mkEnableOption "should sync thing be enabled on this device"; |     enable = lib.mkEnableOption "should sync thing be enabled on this device"; | ||||||
|  | @ -72,7 +73,7 @@ in { | ||||||
|           user = "syncthing"; |           user = "syncthing"; | ||||||
|           group = "syncthing"; |           group = "syncthing"; | ||||||
|           dataDir = "${mountDir}/default"; |           dataDir = "${mountDir}/default"; | ||||||
|           configDir = "/etc/syncthing"; |           configDir = configDir; | ||||||
|           overrideDevices = true; |           overrideDevices = true; | ||||||
|           overrideFolders = true; |           overrideFolders = true; | ||||||
|           settings = { |           settings = { | ||||||
|  | @ -165,6 +166,12 @@ in { | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       (lib.mkIf config.host.impermanence.enable { |       (lib.mkIf config.host.impermanence.enable { | ||||||
|  |         assertions = [ | ||||||
|  |           { | ||||||
|  |             assertion = config.services.syncthing.configDir == configDir; | ||||||
|  |             message = "syncthing config dir does not match persistence"; | ||||||
|  |           } | ||||||
|  |         ]; | ||||||
|         environment.persistence = { |         environment.persistence = { | ||||||
|           "/persist/system/root" = { |           "/persist/system/root" = { | ||||||
|             enable = true; |             enable = true; | ||||||
|  | @ -175,6 +182,11 @@ in { | ||||||
|                 user = "syncthing"; |                 user = "syncthing"; | ||||||
|                 group = "syncthing"; |                 group = "syncthing"; | ||||||
|               } |               } | ||||||
|  |               { | ||||||
|  |                 directory = configDir; | ||||||
|  |                 user = "syncthing"; | ||||||
|  |                 group = "syncthing"; | ||||||
|  |               } | ||||||
|             ]; |             ]; | ||||||
|           }; |           }; | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue