flake/modules/nixos/server/search.nix
2024-11-29 16:08:28 +00:00

48 lines
1.1 KiB
Nix

{ pkgs, lib, config, ... }:
let
inherit (lib) types mkOption mkEnableOption;
cfg = config.mods.server.search;
in {
options.mods.server.search = {
enable = mkEnableOption {
default = false;
description = "enables search engine server";
};
port = mkOption {
type = types.port;
default = 8081;
};
nginx = mkOption {
type = types.nullOr types.str;
default = "search";
};
};
config = {
services.searx = lib.mkIf cfg.enable {
enable = true;
runInUwsgi = true;
uwsgiConfig = {
disable-logging = true;
http = ":${toString cfg.port}";
};
settings = {
server.port = cfg.port;
server.bind_address = "0.0.0.0";
server.secret_key = "temporary-before-sops";
enabled_plugins = [ "Hostnames plugin" "Tracker URL remover" ];
hostnames.remove = [ "(.*.)?facebook.com$" ];
hostnames.replace = {
"(.*.)?reddit.com$" = "redlib.northboot.xyz";
"(.*.)?youtube.com$" = "invidious.example.com";
};
};
};
};
}