From 4b5dd6a2895dde26c38498d0d899aaa12b009a69 Mon Sep 17 00:00:00 2001 From: "quentin@aristote.fr" Date: Mon, 12 Oct 2026 10:38:20 +0200 Subject: searx: filtron -> limiter --- config/services/web/searx/default.nix | 88 +++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 19 deletions(-) (limited to 'config/services/web/searx/default.nix') diff --git a/config/services/web/searx/default.nix b/config/services/web/searx/default.nix index 46afcd8..6681366 100644 --- a/config/services/web/searx/default.nix +++ b/config/services/web/searx/default.nix @@ -1,37 +1,87 @@ { config, lib, + pkgs, ... }: let - cfg = { - searx = config.services.searx; - filtron = config.services.filtron; - }; + cfg = config.services.searx; in { imports = [ - ./searx - ./filtron + ./engines.nix + ./limiter.nix ]; - services.nginx.virtualHosts.searx = lib.mkIf (cfg.searx.enable && cfg.filtron.enable) { - serverName = "searx.${config.networking.domain}"; - locations = { - "/" = { - proxyPass = "http://${cfg.filtron.listen.address}:${toString cfg.filtron.listen.port}"; - extraConfig = '' - proxy_set_header Connection $http_connection; - proxy_set_header X-Scheme $scheme; - # proxy_set_header X-Script-Name /; - ''; - }; - "/static/".alias = "${cfg.searx.package}/share/static/"; + services.nginx.virtualHosts."searx.aristote.fr" = lib.mkIf (cfg.enable && cfg.configureNginx) { + locations."/" = { + extraConfig = '' + proxy_set_header Host $host; + proxy_set_header Connection $http_connection; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + # proxy_set_header X-Script-Name /; + ''; }; forceSSL = true; enableACME = true; }; - systemd.services.uwsgi.personal.monitor = true; + services.searx = { + enable = true; + package = pkgs.searxng; + + configureNginx = true; + domain = "searx.aristote.fr"; + + configureUwsgi = true; + uwsgiConfig = { + cache2 = "name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1"; + }; + + environmentFile = "/etc/searx/secrets"; + settings = { + use_default_settings = true; + general = { + debug = true; + contact_url = "mailto:quentin@${config.networking.domain}"; + enable_stats = false; + }; + search = { + autocomplete = "wikipedia"; + default_lang = "all"; + formats = [ + "html" + "json" + ]; + }; + server = { + secret_key = "@SECRET_KEY@"; + image_proxy = true; + http_protocol_version = "1.0"; + method = "GET"; + }; + ui = { + theme_args = { + oscar_style = "pointhi"; + }; + }; + enabled_plugins = [ + "Open Access DOI rewrite" + "Hash plugin" + "HTTPS rewrite" + "Self Informations" + "Search on category select" + "Tracker URL remover" + "Vim-like hotkeys" + ]; + }; + }; + + systemd.services = { + searx-init.personal.monitor = true; + uwsgi.personal.monitor = true; + }; } -- cgit v1.3.1