From 40d0b5f55cc32f539f74cea4d2d711d255b20795 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Sat, 11 Feb 2023 03:15:49 +0100 Subject: [PATCH] searx: Add service. WIP: use git version --- hosts/architect/searx.nix | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 hosts/architect/searx.nix diff --git a/hosts/architect/searx.nix b/hosts/architect/searx.nix new file mode 100644 index 0000000..97b304b --- /dev/null +++ b/hosts/architect/searx.nix @@ -0,0 +1,64 @@ +{ mach-nix, lib, config, pkgs, ... }: + +let + domain = "gugol.giugl.io"; + network = import ./network.nix; +in +{ + services = { + redis.servers."searx" = { enable = true; port = 4456; }; + searx = { + enable = true; + package = mach-nix.buildPythonPackage "https://github.com/searxng/searxng/commit/2cf1425e8bc5d3143b6e001e82a034a794e8a206https://github.com/searxng/searxng/commit/2cf1425e8bc5d3143b6e001e82a034a794e8a206"; + + environmentFile = /secrets/searx/env; + settings = { + server = { + secret_key = "@SEARX_SECRET_KEY@"; + port = 4455; + }; + + general = { + instance_name = "Pepe's Gugol"; + contact_url = "mailto:gugol@depasquale.giugl.io"; + enable_metrics = false; + }; + + search = { + safe_search = 0; + autocomplete = "duckduckgo"; + prefer_configured_language = false; + }; + + ui = { + infinite_scroll = true; + }; + + redis.url = "127.0.0.1:${toString config.services.redis.servers."searx".port}"; + + engines = [ + { name = "google"; disabled = false; } + { name = "bing"; disabled = false; } + { name = "qwant"; disabled = false; } + { name = "duckduckgo"; disabled = false; } + { name = "yahoo"; disabled = false; } + ]; + }; + }; + + nginx.virtualHosts.${domain} = { + forceSSL = true; + enableACME = true; + + locations."/" = { + proxyPass = "http://127.0.0.1:${toString config.services.searx.settings.server.port}"; + }; + }; + }; + + networking.extraHosts = '' + ${network.architect-lan} ${domain} + ${network.architect-wg} ${domain} + ${network.architect-ts} ${domain} + ''; +}