add(searxng): configure searxng, with redlib implementation
fuck you reddit
This commit is contained in:
parent
10c17cb4ee
commit
749e60ae53
4 changed files with 67 additions and 0 deletions
55
modules/nixos/services/searxng/default.nix
Normal file
55
modules/nixos/services/searxng/default.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.${namespace};
|
||||
let
|
||||
cfg = config.${namespace}.services.searxng;
|
||||
in
|
||||
{
|
||||
options.${namespace}.services.searxng = with types; {
|
||||
enable = mkBoolOpt false "SearXNG";
|
||||
redlib = mkBoolOpt true "Whether or not to enable redlib.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networking.firewall.allowedTCPPorts = [ 1340 ];
|
||||
|
||||
services.searx = {
|
||||
enable = true;
|
||||
environmentFile = "/run/secrets/searxng";
|
||||
settings.server = {
|
||||
port = "1340";
|
||||
bind_address = "0.0.0.0";
|
||||
use_default_settings = true;
|
||||
secret_key = "@secret_key@";
|
||||
};
|
||||
};
|
||||
|
||||
services.redlib = mkIf cfg.redlib {
|
||||
enable = true;
|
||||
address = "0.0.0.0";
|
||||
port = 1341;
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
services.searx.settings.searx = mkIf cfg.redlib {
|
||||
plugins.hostnames.SXNGPlugin.active = true;
|
||||
};
|
||||
|
||||
services.searx.settings.hostnames.replace = mkIf cfg.redlib {
|
||||
"(.*\.)?reddit\.com$" = "reddit.monapona.dev";
|
||||
"(.*\.)?redd\.it$" = "reddit.monapona.dev";
|
||||
};
|
||||
|
||||
sops.secrets.searxng = {
|
||||
format = "dotenv";
|
||||
sopsFile = ../../../../secrets/blarm-searxng.env;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue