From 754832f815bda4c941af3e7d27a5886a17dc6043 Mon Sep 17 00:00:00 2001 From: cw Date: Sun, 30 Apr 2023 03:02:44 -0500 Subject: [PATCH] Add searx profile w/ smolweb search --- profiles/searx.nix | 105 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 profiles/searx.nix diff --git a/profiles/searx.nix b/profiles/searx.nix new file mode 100644 index 0000000..4f1bae1 --- /dev/null +++ b/profiles/searx.nix @@ -0,0 +1,105 @@ +{ pkgs, config, lib, ... }: +let + fqdn = "searx.${config.networking.fqdn}"; + +in +{ + networking.extraHosts = "127.0.0.1 ${fqdn}"; + services.morty = { + enable = false; + key = "dJoLJYyLpU4ukIs3W4kXgYsHTMwJb8nDRKuu3WmC1gmS"; + port = 3000; + }; + services.searx = { + enable = true; + settings = { + general = { + debug = false; + instance_name = "${fqdn}"; + }; + ui = { + default_theme = "simple"; + }; + server = { + port = 8980; + bind_address = "127.0.0.1"; + secret_key = "REMOVEthisANDchangeITtoSOMETHINGelsey7r8u39ir30o10oe19ie28ury643r4t"; + base_url = if config.security.acme.acceptTerms then "https://${fqdn}" else "http://${fqdn}"; + }; + engines = [ + { name = "marginalia"; + engine = "json_engine"; + paging = true; + search_url = "https://api.marginalia.nu/public/search/{query}?index={pageno}"; + results_query = "results"; + url_query = "url"; + title_query = "title"; + content_query = "description"; + categories = "smolweb"; + timeout = 5; + page_size = 10; + shortcut = "marginalia"; + } + { name = "lieu"; + engine = "xpath"; + search_url = "https://lieu.cblgh.org/?q={query}"; + results_xpath = "//li[@class=\"entry\"]"; + url_xpath = ".//a/@href"; + title_xpath = ".//a/@href"; + content_xpath = ".//p"; + categories = "smolweb"; + timeout = 5; + shortcut = "lieu"; + } + { name = "lieu-external"; + engine = "xpath"; + search_url = "https://lieu.cblgh.org/outgoing?q={query}"; + results_xpath = "//li[@class=\"entry\"]"; + url_xpath = ".//a/@href"; + title_xpath = ".//a"; + content_xpath = ".//a"; + categories = "smolweb"; + timeout = 5; + disabled = true; + shortcut = "lieuext"; + } + { name = "wiby"; + engine = "xpath"; + search_url = "https://wiby.me/?q={query}"; + results_xpath = "//blockquote"; + url_xpath = ".//a/@href"; + title_xpath = ".//a"; + content_xpath = ".//a"; + categories = "smolweb"; + timeout = 5; + disabled = false; + shortcut = "wiby"; + } + { name = "teclis"; + engine = "xpath"; + search_url = "https://teclis.com/search?q={query}"; + results_xpath = "//ul[@class=\"result-items\"]/li[not(@class)]"; + url_xpath = "./p/a/@href"; + title_xpath = "./a"; + content_xpath = "./span"; + categories = "smolweb"; + timeout = 5; + # disabled = true; + shortcut = "teclis"; + } + # { name = "geminispace.info"; + # engine = "xpath"; + # search_url = "https://teclis.com/search?q={query}"; + # results_xpath = "//ul[@class=\"result-items\"]/li"; + # url_xpath = "./p/a/@href"; + # title_xpath = "./a"; + # content_xpath = "./span"; + # categories = "smolweb"; + # timeout = 10; + # shortcut = "teclis"; + # } + ]; + }; + }; + helpers.webservices."${fqdn}".port = config.services.searx.settings.server.port; +} -- 2.44.1