forked from jan-leila/nix-config
		
	moved service config out of host namespace
This commit is contained in:
		
							parent
							
								
									c7938c3fe7
								
							
						
					
					
						commit
						597c25b49d
					
				
					 7 changed files with 98 additions and 125 deletions
				
			
		|  | @ -4,8 +4,7 @@ | |||
|   inputs, | ||||
|   ... | ||||
| }: { | ||||
|   options.host.searx = { | ||||
|     enable = lib.mkEnableOption "should searx be enabled on this computer"; | ||||
|   options.services.searx = { | ||||
|     subdomain = lib.mkOption { | ||||
|       type = lib.types.str; | ||||
|       description = "subdomain of base domain that searx will be hosted at"; | ||||
|  | @ -13,7 +12,7 @@ | |||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.host.searx.enable { | ||||
|   config = lib.mkIf config.services.searx.enable { | ||||
|     sops.secrets = { | ||||
|       "services/searx" = { | ||||
|         sopsFile = "${inputs.secrets}/defiant-services.yaml"; | ||||
|  | @ -21,56 +20,53 @@ | |||
|     }; | ||||
|     host = { | ||||
|       reverse_proxy.subdomains.searx = { | ||||
|         subdomain = config.host.searx.subdomain; | ||||
|         subdomain = config.services.searx.subdomain; | ||||
|         target = "http://localhost:${toString config.services.searx.settings.server.port}"; | ||||
|       }; | ||||
|     }; | ||||
|     services = { | ||||
|       searx = { | ||||
|         enable = true; | ||||
|         environmentFile = config.sops.secrets."services/searx".path; | ||||
|     services.searx = { | ||||
|       environmentFile = config.sops.secrets."services/searx".path; | ||||
| 
 | ||||
|         # Rate limiting | ||||
|         limiterSettings = { | ||||
|           real_ip = { | ||||
|             x_for = 1; | ||||
|             ipv4_prefix = 32; | ||||
|             ipv6_prefix = 56; | ||||
|           }; | ||||
| 
 | ||||
|           botdetection = { | ||||
|             ip_limit = { | ||||
|               filter_link_local = true; | ||||
|               link_token = true; | ||||
|             }; | ||||
|           }; | ||||
|       # Rate limiting | ||||
|       limiterSettings = { | ||||
|         real_ip = { | ||||
|           x_for = 1; | ||||
|           ipv4_prefix = 32; | ||||
|           ipv6_prefix = 56; | ||||
|         }; | ||||
| 
 | ||||
|         settings = { | ||||
|           server = { | ||||
|             port = 8083; | ||||
|             secret_key = "@SEARXNG_SECRET@"; | ||||
|         botdetection = { | ||||
|           ip_limit = { | ||||
|             filter_link_local = true; | ||||
|             link_token = true; | ||||
|           }; | ||||
| 
 | ||||
|           # Search engine settings | ||||
|           search = { | ||||
|             safe_search = 2; | ||||
|             autocomplete_min = 2; | ||||
|             autocomplete = "duckduckgo"; | ||||
|           }; | ||||
| 
 | ||||
|           # Enabled plugins | ||||
|           enabled_plugins = [ | ||||
|             "Basic Calculator" | ||||
|             "Hash plugin" | ||||
|             "Tor check plugin" | ||||
|             "Open Access DOI rewrite" | ||||
|             "Hostnames plugin" | ||||
|             "Unit converter plugin" | ||||
|             "Tracker URL remover" | ||||
|           ]; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       settings = { | ||||
|         server = { | ||||
|           port = 8083; | ||||
|           secret_key = "@SEARXNG_SECRET@"; | ||||
|         }; | ||||
| 
 | ||||
|         # Search engine settings | ||||
|         search = { | ||||
|           safe_search = 2; | ||||
|           autocomplete_min = 2; | ||||
|           autocomplete = "duckduckgo"; | ||||
|         }; | ||||
| 
 | ||||
|         # Enabled plugins | ||||
|         enabled_plugins = [ | ||||
|           "Basic Calculator" | ||||
|           "Hash plugin" | ||||
|           "Tor check plugin" | ||||
|           "Open Access DOI rewrite" | ||||
|           "Hostnames plugin" | ||||
|           "Unit converter plugin" | ||||
|           "Tracker URL remover" | ||||
|         ]; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue