forked from jan-leila/nix-config
		
	feat: added per service enable options for impermanence configs
This commit is contained in:
		
							parent
							
								
									a8af8930fa
								
							
						
					
					
						commit
						89793fca6a
					
				
					 15 changed files with 120 additions and 15 deletions
				
			
		|  | @ -6,7 +6,14 @@ | |||
|   const = import ./const.nix; | ||||
|   dataDirectory = const.dataDirectory; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.actual.enable && config.host.impermanence.enable) { | ||||
|   options.services.actual = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.actual.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.actual.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.actual.settings.ACTUAL_DATA_DIR == dataDirectory; | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   bazarr_data_directory = "/var/lib/bazarr"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.bazarr.enable && config.host.impermanence.enable) { | ||||
|   options.services.bazarr = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.bazarr.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.bazarr.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.bazarr.dataDir == bazarr_data_directory; | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   workingDirectory = "/var/lib/private/crab-hole"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.crab-hole.enable && config.host.impermanence.enable) { | ||||
|   options.services.crab-hole = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.crab-hole.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.crab-hole.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = | ||||
|  |  | |||
|  | @ -6,7 +6,14 @@ | |||
|   dataFolder = "/var/lib/fail2ban"; | ||||
|   dataFile = "fail2ban.sqlite3"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.fail2ban.enable && config.host.impermanence.enable) { | ||||
|   options.services.fail2ban = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.fail2ban.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.fail2ban.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.fail2ban.daemonSettings.Definition.dbfile == "${dataFolder}/${dataFile}"; | ||||
|  |  | |||
|  | @ -3,7 +3,14 @@ | |||
|   config, | ||||
|   ... | ||||
| }: { | ||||
|   config = lib.mkIf (config.services.flaresolverr.enable && config.host.impermanence.enable) { | ||||
|   options.services.flaresolverr = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.flaresolverr.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.flaresolverr.impermanence.enable { | ||||
|     # FlareSolverr typically doesn't need persistent storage as it's a proxy service | ||||
|     # but we'll add basic structure in case it's needed for logs or configuration | ||||
|     environment.persistence."/persist/system/root" = { | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   stateDir = "/var/lib/forgejo"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.forgejo.enable && config.host.impermanence.enable) { | ||||
|   options.services.forgejo = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.forgejo.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.forgejo.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.forgejo.stateDir == stateDir; | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   mediaLocation = "/var/lib/immich"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.immich.enable && config.host.impermanence.enable) { | ||||
|   options.services.immich = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.immich.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.immich.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.immich.mediaLocation == mediaLocation; | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   jackett_data_directory = "/var/lib/jackett/.config/Jackett"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.jackett.enable && config.host.impermanence.enable) { | ||||
|   options.services.jackett = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.jackett.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.jackett.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.jackett.dataDir == jackett_data_directory; | ||||
|  |  | |||
|  | @ -6,7 +6,14 @@ | |||
|   jellyfin_data_directory = "/var/lib/jellyfin"; | ||||
|   jellyfin_cache_directory = "/var/cache/jellyfin"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.jellyfin.enable && config.host.impermanence.enable) { | ||||
|   options.services.jellyfin = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.jellyfin.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.jellyfin.impermanence.enable { | ||||
|     fileSystems."/persist/system/jellyfin".neededForBoot = true; | ||||
| 
 | ||||
|     host.storage.pool.extraDatasets = { | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   lidarr_data_directory = "/var/lib/lidarr/.config/Lidarr"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.lidarr.enable && config.host.impermanence.enable) { | ||||
|   options.services.lidarr = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.lidarr.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.lidarr.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.lidarr.dataDir == lidarr_data_directory; | ||||
|  |  | |||
|  | @ -3,7 +3,14 @@ | |||
|   config, | ||||
|   ... | ||||
| }: { | ||||
|   config = lib.mkIf (config.services.panoramax.enable && config.host.impermanence.enable) { | ||||
|   options.services.panoramax = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.panoramax.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.panoramax.impermanence.enable { | ||||
|     # TODO: configure impermanence for panoramax data | ||||
|     # This would typically include directories like: | ||||
|     # - /var/lib/panoramax | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   dataDir = "/var/lib/paperless"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.paperless.enable && config.host.impermanence.enable) { | ||||
|   options.services.paperless = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.paperless.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.paperless.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.paperless.dataDir == dataDir; | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   qbittorent_profile_directory = "/var/lib/qBittorrent/"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.qbittorrent.enable && config.host.impermanence.enable) { | ||||
|   options.services.qbittorrent = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.qbittorrent.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.qbittorrent.impermanence.enable { | ||||
|     fileSystems."/persist/system/qbittorrent".neededForBoot = true; | ||||
| 
 | ||||
|     host.storage.pool.extraDatasets = { | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   radarr_data_directory = "/var/lib/radarr/.config/Radarr"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.radarr.enable && config.host.impermanence.enable) { | ||||
|   options.services.radarr = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.radarr.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.radarr.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.radarr.dataDir == radarr_data_directory; | ||||
|  |  | |||
|  | @ -5,7 +5,14 @@ | |||
| }: let | ||||
|   sonarr_data_directory = "/var/lib/sonarr/.config/NzbDrone"; | ||||
| in { | ||||
|   config = lib.mkIf (config.services.sonarr.enable && config.host.impermanence.enable) { | ||||
|   options.services.sonarr = { | ||||
|     impermanence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = config.services.sonarr.enable && config.host.impermanence.enable; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.sonarr.impermanence.enable { | ||||
|     assertions = [ | ||||
|       { | ||||
|         assertion = config.services.sonarr.dataDir == sonarr_data_directory; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue