]> Untitled Git - MarigoldOS/.git/commitdiff
Add searx profile w/ smolweb search
authorcw <beetr00ts@pm.me>
Sun, 30 Apr 2023 08:02:44 +0000 (03:02 -0500)
committercw <beetr00ts@pm.me>
Sun, 30 Apr 2023 08:02:44 +0000 (03:02 -0500)
profiles/searx.nix [new file with mode: 0644]

diff --git a/profiles/searx.nix b/profiles/searx.nix
new file mode 100644 (file)
index 0000000..4f1bae1
--- /dev/null
@@ -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;
+}