summaryrefslogtreecommitdiff
path: root/config/services/web/searx/default.nix
blob: da4cf8844bd4fa8e53711a75c3920499497ba76d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
  config,
  lib,
  ...
}:

let
  cfg = {
    searx = config.services.searx;
    filtron = config.services.filtron;
  };
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/";
    };
    forceSSL = true;
    enableACME = true;
  };

  systemd.services.uwsgi.personal.monitor = true;
}