refactor: moved nixos modules to dendrite pattern
This commit is contained in:
parent
df8dd110ad
commit
0ea11e0236
219 changed files with 4802 additions and 4820 deletions
10
modules/nixos/programs/searx/default.nix
Normal file
10
modules/nixos/programs/searx/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{config, ...}: let
|
||||
mod = config.flake.nixosModules;
|
||||
in {
|
||||
flake.nixosModules.searx = {
|
||||
imports = [
|
||||
mod.searx-service
|
||||
mod.searx-proxy
|
||||
];
|
||||
};
|
||||
}
|
||||
33
modules/nixos/programs/searx/proxy.nix
Normal file
33
modules/nixos/programs/searx/proxy.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{...}: {
|
||||
flake.nixosModules.searx-proxy = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options.services.searx = {
|
||||
extraDomains = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = "extra domains that should be configured for searx";
|
||||
default = [];
|
||||
};
|
||||
reverseProxy = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.services.searx.enable && config.services.reverseProxy.enable;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.searx.reverseProxy.enable {
|
||||
services.reverseProxy.services.searx = {
|
||||
target = "http://localhost:${toString config.services.searx.settings.server.port}";
|
||||
domain = config.services.searx.domain;
|
||||
extraDomains = config.services.searx.extraDomains;
|
||||
|
||||
settings = {
|
||||
forwardHeaders.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
61
modules/nixos/programs/searx/searx.nix
Normal file
61
modules/nixos/programs/searx/searx.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{...}: {
|
||||
flake.nixosModules.searx-service = {
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
config = lib.mkIf config.services.searx.enable {
|
||||
sops.secrets = {
|
||||
"services/searx" = {
|
||||
sopsFile = "${inputs.secrets}/defiant-services.yaml";
|
||||
};
|
||||
};
|
||||
|
||||
services.searx = {
|
||||
environmentFile = config.sops.secrets."services/searx".path;
|
||||
|
||||
# Rate limiting
|
||||
limiterSettings = {
|
||||
real_ip = {
|
||||
x_for = 1;
|
||||
ipv4_prefix = 32;
|
||||
ipv6_prefix = 56;
|
||||
};
|
||||
|
||||
botdetection = {
|
||||
ip_limit = {
|
||||
filter_link_local = true;
|
||||
link_token = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
port = 8083;
|
||||
secret_key = "@SEARXNG_SECRET@";
|
||||
};
|
||||
|
||||
# Search engine settings
|
||||
search = {
|
||||
safe_search = 2;
|
||||
autocomplete_min = 2;
|
||||
autocomplete = "duckduckgo";
|
||||
};
|
||||
|
||||
# Enabled plugins
|
||||
enabled_plugins = [
|
||||
"Basic Calculator"
|
||||
"Hash plugin"
|
||||
"Tor check plugin"
|
||||
"Open Access DOI rewrite"
|
||||
"Hostnames plugin"
|
||||
"Unit converter plugin"
|
||||
"Tracker URL remover"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue