aboutsummaryrefslogtreecommitdiff
path: root/modules/services/searx/default.nix
blob: f7c00fbc95076f5e111a830ef6a66c35354f6f08 (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
41
42
43
44
45
46
47
48
49
50
51
52
{
  config,
  lib,
  pkgs,
  ...
}:
with lib;
let
  cfg = config.modules.services.searx;
in
{
  options.modules.services.searx = {
    enable = mkEnableOption "searx";
    port = mkOption {
      default = 8888;
      type = types.int;
    };
    environmentFile = mkOption {
      default = "/var/lib/searx/env";
      type = types.str;
    };
  };

  config = mkIf cfg.enable {
    networking.firewall.allowedTCPPorts = [ cfg.port ];
    services.searx = {
      enable = true;
      package = pkgs.searxng;
      environmentFile = cfg.environmentFile;
      settings = {
        general = {
          debug = false;
          instance_name = "searx";
        };
        server = {
          port = cfg.port;
          bind_address = "0.0.0.0";
          secret_key = "@SEARX_SECRET_KEY@";
          public_instance = false;
          image_proxy = true;
        };
        search = {
          safe_search = 1;
          autocomplete = "duckduckgo";
          autocomplete_min = 4;
          default_lang = "en-US";
        };
        ui.static_use_hash = true;
      };
    };
  };
}