nix/container/Search.nix

139 lines
3.3 KiB
Nix
Raw Normal View History

{
2024-11-04 04:37:29 +03:00
config,
container,
lib,
pkgs,
...
}: let
cfg = config.container.module.search;
in {
options.container.module.search = {
enable = lib.mkEnableOption "the search frontend.";
address = lib.mkOption {
default = "10.1.0.26";
type = lib.types.str;
};
port = lib.mkOption {
default = 8080;
type = lib.types.int;
};
domain = lib.mkOption {
default = "search.${config.container.domain}";
type = lib.types.str;
};
storage = lib.mkOption {
default = "${config.container.storage}/search";
type = lib.types.str;
};
};
2024-06-25 04:04:39 +03:00
2024-11-04 04:37:29 +03:00
config = lib.mkIf cfg.enable {
containers.search = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg {
services.searx = {
enable = true;
package = pkgs.searxng;
# REF: https://github.com/searxng/searxng/blob/master/searx/settings.yml
settings = {
general = {
debug = false;
enable_metrics = false;
instance_name = "SearX";
};
server = {
bind_address = cfg.address;
image_proxy = false;
limiter = false;
method = "GET";
port = cfg.port;
public_instance = false;
secret_key = "searxxx";
};
search = {
autocomplete = "";
autocomplete_min = 4;
default_lang = "auto";
safe_search = 0;
};
ui = {
center_alignment = false;
default_locale = "";
default_theme = "simple";
hotkeys = "vim";
infinite_scroll = false;
simple_style = "dark";
};
outgoing = {
enable_http2 = true;
max_request_timeout = 10.0;
pool_connections = 100;
pool_maxsize = 20;
request_timeout = 3.0;
# proxies = {
# "all://" = with config.container.module; [
# # "socks5:${frkn.address}:${frkn.port}"
# "socks5:${frkn.address}:1081"
# # "socks5:${frkn.address}:9150"
# ];
# };
# using_tor_proxy = true;
# extra_proxy_timeout = 10;
};
# plugins = [ ];
enabled_plugins = [
"Basic Calculator"
"Hostnames plugin"
"Tracker URL remover"
];
hostnames = {
replace = with config.container.module; {
"(.*\.)?youtu\.be$" = yt.domain;
"(.*\.)?youtube\.com$" = yt.domain;
};
remove = [
2024-11-06 06:07:45 +03:00
"(.*\.)?dzen\.ru$"
2024-11-04 04:37:29 +03:00
"(.*\.)?facebook.com$"
2024-11-06 06:07:45 +03:00
"(.*\.)?gosuslugi\.ru$"
"(.*\.)?quora\.com$"
"(.*\.)?rutube\.ru$"
"(.*\.)?vk\.com$"
2024-11-04 04:37:29 +03:00
];
low_priority = [
"(.*\.)?google(\..*)?$"
2024-11-06 06:07:45 +03:00
"(.*\.)?microsoft\.com$"
2024-11-04 04:37:29 +03:00
];
high_priority = [
"(.*\.)?4pda.to$"
"(.*\.)?github.com$"
"(.*\.)?wikipedia.org$"
];
};
categories_as_tabs = {
files = { };
general = { };
images = { };
it = { };
map = { };
news = { };
videos = { };
};
engines = let
mkEnable = name: {
inherit name;
disabled = false;
};
mkDisable = name: {
inherit name;
disabled = true;
};
in [
(mkEnable "bing")
(mkDisable "qwant")
];
};
};
};
};
};
2024-06-09 23:35:53 +03:00
}