forked from jan-leila/nix-config
		
	added searx service
This commit is contained in:
		
							parent
							
								
									5a04603c85
								
							
						
					
					
						commit
						1824bc8cc9
					
				
					 4 changed files with 45 additions and 32 deletions
				
			
		|  | @ -73,6 +73,10 @@ | ||||||
|       enable = true; |       enable = true; | ||||||
|       subdomain = "git"; |       subdomain = "git"; | ||||||
|     }; |     }; | ||||||
|  |     searx = { | ||||||
|  |       enable = true; | ||||||
|  |       subdomain = "search"; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
|   networking = { |   networking = { | ||||||
|     hostId = "c51763d6"; |     hostId = "c51763d6"; | ||||||
|  |  | ||||||
|  | @ -81,18 +81,6 @@ in { | ||||||
|           default = "${config.apps.home-assistant.subdomain}.${config.apps.base_domain}"; |           default = "${config.apps.home-assistant.subdomain}.${config.apps.base_domain}"; | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|       searx = { |  | ||||||
|         subdomain = lib.mkOption { |  | ||||||
|           type = lib.types.str; |  | ||||||
|           description = "subdomain of base domain that searx will be hosted at"; |  | ||||||
|           default = "search"; |  | ||||||
|         }; |  | ||||||
|         hostname = lib.mkOption { |  | ||||||
|           type = lib.types.str; |  | ||||||
|           description = "hostname that searx will be hosted at"; |  | ||||||
|           default = "${config.apps.searx.subdomain}.${config.apps.base_domain}"; |  | ||||||
|         }; |  | ||||||
|       }; |  | ||||||
|       nextcloud = { |       nextcloud = { | ||||||
|         subdomain = lib.mkOption { |         subdomain = lib.mkOption { | ||||||
|           type = lib.types.str; |           type = lib.types.str; | ||||||
|  | @ -113,9 +101,6 @@ in { | ||||||
|       "services/pi-hole" = { |       "services/pi-hole" = { | ||||||
|         sopsFile = "${inputs.secrets}/defiant-services.yaml"; |         sopsFile = "${inputs.secrets}/defiant-services.yaml"; | ||||||
|       }; |       }; | ||||||
|       "services/searx" = { |  | ||||||
|         sopsFile = "${inputs.secrets}/defiant-services.yaml"; |  | ||||||
|       }; |  | ||||||
|       "services/nextcloud_adminpass" = { |       "services/nextcloud_adminpass" = { | ||||||
|         sopsFile = "${inputs.secrets}/defiant-services.yaml"; |         sopsFile = "${inputs.secrets}/defiant-services.yaml"; | ||||||
|         owner = config.users.users.nextcloud.name; |         owner = config.users.users.nextcloud.name; | ||||||
|  | @ -265,17 +250,6 @@ in { | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       searx = { |  | ||||||
|         enable = true; |  | ||||||
|         environmentFile = config.sops.secrets."services/searx".path; |  | ||||||
|         settings = { |  | ||||||
|           server = { |  | ||||||
|             port = 8083; |  | ||||||
|             secret_key = "@SEARXNG_SECRET@"; |  | ||||||
|           }; |  | ||||||
|         }; |  | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       # nextcloud here is built using its auto setup mysql db because it was not playing nice with postgres |       # nextcloud here is built using its auto setup mysql db because it was not playing nice with postgres | ||||||
|       nextcloud = { |       nextcloud = { | ||||||
|         enable = true; |         enable = true; | ||||||
|  | @ -307,11 +281,6 @@ in { | ||||||
|             # enableACME = true; |             # enableACME = true; | ||||||
|             locations."/".proxyPass = "http://localhost:${toString config.services.home-assistant.config.http.server_port}"; |             locations."/".proxyPass = "http://localhost:${toString config.services.home-assistant.config.http.server_port}"; | ||||||
|           }; |           }; | ||||||
|           ${config.apps.searx.hostname} = { |  | ||||||
|             # forceSSL = true; |  | ||||||
|             # enableACME = true; |  | ||||||
|             locations."/".proxyPass = "http://localhost:${toString config.services.searx.settings.server.port}"; |  | ||||||
|           }; |  | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|  | @ -333,7 +302,6 @@ in { | ||||||
|         config.services.forgejo.settings.server.HTTP_PORT |         config.services.forgejo.settings.server.HTTP_PORT | ||||||
|         config.services.home-assistant.config.http.server_port |         config.services.home-assistant.config.http.server_port | ||||||
|         config.services.postgresql.settings.port |         config.services.postgresql.settings.port | ||||||
|         config.services.searx.settings.server.port |  | ||||||
|       ]); |       ]); | ||||||
| 
 | 
 | ||||||
|     environment.systemPackages = [ |     environment.systemPackages = [ | ||||||
|  |  | ||||||
|  | @ -5,5 +5,6 @@ | ||||||
|     ./postgres.nix |     ./postgres.nix | ||||||
|     ./jellyfin.nix |     ./jellyfin.nix | ||||||
|     ./forgejo.nix |     ./forgejo.nix | ||||||
|  |     ./searx.nix | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								modules/nixos-modules/server/searx.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								modules/nixos-modules/server/searx.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   inputs, | ||||||
|  |   ... | ||||||
|  | }: { | ||||||
|  |   options.host.searx = { | ||||||
|  |     enable = lib.mkEnableOption "should searx be enabled on this computer"; | ||||||
|  |     subdomain = lib.mkOption { | ||||||
|  |       type = lib.types.str; | ||||||
|  |       description = "subdomain of base domain that searx will be hosted at"; | ||||||
|  |       default = "searx"; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = lib.mkIf config.host.searx.enable { | ||||||
|  |     sops.secrets = { | ||||||
|  |       "services/searx" = { | ||||||
|  |         sopsFile = "${inputs.secrets}/defiant-services.yaml"; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |     host = { | ||||||
|  |       reverse_proxy.subdomains.${config.host.searx.subdomain} = { | ||||||
|  |         target = "http://localhost:${toString config.services.searx.settings.server.port}"; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |     services = { | ||||||
|  |       searx = { | ||||||
|  |         enable = true; | ||||||
|  |         environmentFile = config.sops.secrets."services/searx".path; | ||||||
|  |         settings = { | ||||||
|  |           server = { | ||||||
|  |             port = 8083; | ||||||
|  |             secret_key = "@SEARXNG_SECRET@"; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue