diff options
Diffstat (limited to 'config/services/web/searx')
| -rw-r--r-- | config/services/web/searx/default.nix | 51 | ||||
| -rw-r--r-- | config/services/web/searx/morty/default.nix | 20 | ||||
| -rw-r--r-- | config/services/web/searx/searx/default.nix | 31 |
3 files changed, 46 insertions, 56 deletions
diff --git a/config/services/web/searx/default.nix b/config/services/web/searx/default.nix index 5998068..da4cf88 100644 --- a/config/services/web/searx/default.nix +++ b/config/services/web/searx/default.nix @@ -1,35 +1,40 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + ... +}: let cfg = { searx = config.services.searx; filtron = config.services.filtron; }; -in { - imports = [ ./searx ./filtron ./morty ]; +in +{ + imports = [ + ./searx + ./filtron + ]; - 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 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 /; - ''; - }; - "/static/".alias = "${cfg.searx.package}/share/static/"; + 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 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; + "/static/".alias = "${cfg.searx.package}/share/static/"; }; + forceSSL = true; + enableACME = true; + }; systemd.services.uwsgi.personal.monitor = true; } diff --git a/config/services/web/searx/morty/default.nix b/config/services/web/searx/morty/default.nix deleted file mode 100644 index af48fda..0000000 --- a/config/services/web/searx/morty/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, lib, ... }: - -let cfg = config.services.morty; -in { - services.nginx.virtualHosts.searx.locations = - lib.mkIf cfg.enable { - "/morty/" = { - proxyPass = "http://127.0.0.1:${toString cfg.port}"; - 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; - ''; - }; - }; - - services.morty = { enable = false; }; -} diff --git a/config/services/web/searx/searx/default.nix b/config/services/web/searx/searx/default.nix index f109258..003e7dc 100644 --- a/config/services/web/searx/searx/default.nix +++ b/config/services/web/searx/searx/default.nix @@ -1,24 +1,26 @@ -{ config, lib, pkgs, ... }: +{ + config, + pkgs, + ... +}: let - cfg = { - morty = config.services.morty; - filtron = config.services.filtron; - }; -in { + cfg.filtron = config.services.filtron; +in +{ imports = [ ./engines.nix ]; services.searx = { enable = true; package = pkgs.searxng; - runInUwsgi = true; + configureUwsgi = true; uwsgiConfig = { cache2 = "name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1"; http = ":${toString cfg.filtron.target.port}"; }; - environmentFile = /etc/searx/secrets; + environmentFile = "/etc/searx/secrets"; settings = { use_default_settings = true; general = { @@ -29,7 +31,10 @@ in { search = { autocomplete = "wikipedia"; default_lang = "all"; - formats = [ "html" "json" ]; + formats = [ + "html" + "json" + ]; }; server = { secret_key = "@SECRET_KEY@"; @@ -37,10 +42,10 @@ in { http_protocol_version = "1.0"; method = "GET"; }; - ui = { theme_args = { oscar_style = "pointhi"; }; }; - result_proxy = lib.mkIf cfg.morty.enable { - url = "http://searx.${config.networking.domain}/morty"; - key = ''!!binary | "${cfg.morty.key}"''; + ui = { + theme_args = { + oscar_style = "pointhi"; + }; }; enabled_plugins = [ "Open Access DOI rewrite" |
