mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 16:39:07 +01:00
68 lines
1.6 KiB
Nix
68 lines
1.6 KiB
Nix
{
|
|
config,
|
|
self,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.custom.web-services.searxng;
|
|
in
|
|
{
|
|
options.custom.web-services.searxng = {
|
|
enable = lib.mkEnableOption "";
|
|
domain = lib.mkOption {
|
|
type = lib.types.nonEmptyStr;
|
|
default = "";
|
|
};
|
|
port = lib.mkOption {
|
|
type = lib.types.port;
|
|
default = 27916;
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
assertions = lib.singleton {
|
|
assertion = self.lib.isPrivateDomain cfg.domain;
|
|
message = self.lib.mkUnprotectedMessage "SearXNG";
|
|
};
|
|
|
|
services.searx = {
|
|
enable = true;
|
|
settings = {
|
|
server = {
|
|
inherit (cfg) port;
|
|
secret_key = "unnecessary";
|
|
};
|
|
ui.center_alignment = true;
|
|
plugins = {
|
|
"searx.plugins.calculator.SXNGPlugin".active = true;
|
|
"searx.plugins.infinite_scroll.SXNGPlugin".active = true;
|
|
"searx.plugins.self_info.SXNGPlugin".active = true;
|
|
"searx.plugins.hostnames.SXNGPlugin".active = true;
|
|
};
|
|
search = {
|
|
autocomplete = "duckduckgo";
|
|
favicon_resolver = "duckduckgo";
|
|
};
|
|
hostnames = {
|
|
remove = [ "(.*\.)?nixos.wiki$" ];
|
|
high_priority = [
|
|
"(.*\.)?github.com$"
|
|
"(.*\.)?nixos.org$"
|
|
"(.*\.)archlinux.org$"
|
|
"(.*\.)?reddit.com$"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
custom = {
|
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
|
|
|
meta.sites.${cfg.domain} = {
|
|
title = "SearXNG";
|
|
icon = "sh:searxng";
|
|
};
|
|
};
|
|
};
|
|
}
|