diff --git a/configurations/cluster/modules/caddy/default.nix b/configurations/cluster/modules/caddy/default.nix index 82bfe34d..73b0aecb 100644 --- a/configurations/cluster/modules/caddy/default.nix +++ b/configurations/cluster/modules/caddy/default.nix @@ -60,6 +60,7 @@ in { "Vaultwarden" = mkPublicReverseProxy "vault" "${nosIP}:8781" {}; "Hauk" = mkPublicReverseProxy "hauk" "${nosIP}:3003" {}; "Headscale" = mkPublicReverseProxy "headscale" "${clusterIP}:8085" {}; + "SearXNG" = mkPublicReverseProxy "search" "${clusterIP}:8080" {}; "Jellyfin" = mkPublicReverseProxy "jelly" "${nosIP}:8096" { subDirectories.jfa-go = { diff --git a/configurations/cluster/modules/default.nix b/configurations/cluster/modules/default.nix index 9233a79c..f16d29e5 100644 --- a/configurations/cluster/modules/default.nix +++ b/configurations/cluster/modules/default.nix @@ -5,6 +5,7 @@ ./headscale ./nfs-client.nix ./pcsd.nix + ./searxng ./unbound.nix ]; } diff --git a/configurations/cluster/modules/pcsd.nix b/configurations/cluster/modules/pcsd.nix index 75619ddf..455f355b 100644 --- a/configurations/cluster/modules/pcsd.nix +++ b/configurations/cluster/modules/pcsd.nix @@ -48,6 +48,12 @@ in { group = "caddy-grp"; startAfter = ["headscale"]; }; + + "searx" = { + enable = true; + group = "caddy-grp"; + startAfter = ["caddy"]; + }; }; nodes = [ diff --git a/configurations/cluster/modules/searxng/default.nix b/configurations/cluster/modules/searxng/default.nix new file mode 100644 index 00000000..b62b87b9 --- /dev/null +++ b/configurations/cluster/modules/searxng/default.nix @@ -0,0 +1,73 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mapAttrsToList; +in { + services.searx = { + enable = true; + + package = pkgs.searxng.overrideAttrs (o: { + postInstall = '' + ${o.postInstall or ""} + # Replace logo + cp ${./logo.png} $out/${pkgs.python3.sitePackages}/searx/static/themes/simple/img/searxng.png + ''; + }); + + environmentFile = config.sops.secrets.searxng.path; + + settings = { + general = { + instance_name = "Search"; + debug = false; + enable_metrics = false; + }; + + search = { + autocomplete = "google"; + favicon_resolver = "google"; + + safe_search = 0; + + default_lang = "en-CA"; + }; + + ui = { + infinite_scroll = true; + query_in_title = true; + hotkeys = "vim"; + }; + + server = { + port = 8080; + bind_address = config.services.pcsd.virtualIps.caddy-vip.ip; + + secret_key = "@SEARXNG_SECRET@"; + + public_instance = false; + }; + + engines = mapAttrsToList (name: value: {inherit name;} // value) { + "duckduckgo".disabled = false; + "duckduckgo images".disabled = false; + "gitlab".disabled = false; + "qwant".disabled = false; + "reddit".disabled = false; + + "wikipedia" = { + engine = "wikipedia"; + shortcut = "w"; + base_url = "https://wikipedia.org/"; + }; + + "github" = { + engine = "github"; + shortcut = "gh"; + }; + }; + }; + }; +} diff --git a/configurations/cluster/modules/searxng/logo.png b/configurations/cluster/modules/searxng/logo.png new file mode 100644 index 00000000..4f817882 Binary files /dev/null and b/configurations/cluster/modules/searxng/logo.png differ diff --git a/flake.lock b/flake.lock index 25ce9f9f..e1344098 100644 Binary files a/flake.lock and b/flake.lock differ diff --git a/homeManagerModules/firefox/default.nix b/homeManagerModules/firefox/default.nix index a207ba00..b8c7a23d 100644 --- a/homeManagerModules/firefox/default.nix +++ b/homeManagerModules/firefox/default.nix @@ -107,9 +107,20 @@ in { }; search = { - default = "DuckDuckGo"; + default = "SearXNG"; force = true; engines = { + "SearXNG" = { + urls = [ + { + template = "https://search.nelim.org/search?q={searchTerms}"; + } + ]; + iconUpdateURL = "https://search.nelim.org/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = ["@s"]; + }; + "Nixpkgs" = { urls = [ {