]> Untitled Git - MarigoldOS/.git/blob - profiles/searx.nix
Add searx profile w/ smolweb search
[MarigoldOS/.git] / profiles / searx.nix
1 { pkgs, config, lib, ... }:
2 let
3   fqdn = "searx.${config.networking.fqdn}";
4
5 in
6 {
7   networking.extraHosts = "127.0.0.1 ${fqdn}";
8   services.morty = {
9     enable = false;
10     key = "dJoLJYyLpU4ukIs3W4kXgYsHTMwJb8nDRKuu3WmC1gmS";
11     port = 3000;
12   };
13   services.searx = {
14     enable = true;
15     settings = {
16       general = {
17         debug = false;
18         instance_name = "${fqdn}";
19       };
20       ui = {
21         default_theme = "simple";
22       };
23       server = {
24         port = 8980;
25         bind_address = "127.0.0.1";
26         secret_key = "REMOVEthisANDchangeITtoSOMETHINGelsey7r8u39ir30o10oe19ie28ury643r4t";
27         base_url = if config.security.acme.acceptTerms then "https://${fqdn}" else "http://${fqdn}";
28       };
29       engines = [
30         { name = "marginalia";
31           engine = "json_engine";
32           paging = true;
33           search_url = "https://api.marginalia.nu/public/search/{query}?index={pageno}";
34           results_query = "results";
35           url_query = "url";
36           title_query = "title";
37           content_query = "description";
38           categories = "smolweb";
39           timeout = 5;
40           page_size = 10;
41           shortcut = "marginalia";
42         }
43         { name = "lieu";
44           engine = "xpath";
45           search_url = "https://lieu.cblgh.org/?q={query}";
46           results_xpath = "//li[@class=\"entry\"]";
47           url_xpath = ".//a/@href";
48           title_xpath = ".//a/@href";
49           content_xpath = ".//p";
50           categories = "smolweb";
51           timeout = 5;
52           shortcut = "lieu";
53         }
54         { name = "lieu-external";
55           engine = "xpath";
56           search_url = "https://lieu.cblgh.org/outgoing?q={query}";
57           results_xpath = "//li[@class=\"entry\"]";
58           url_xpath = ".//a/@href";
59           title_xpath = ".//a";
60           content_xpath = ".//a";
61           categories = "smolweb";
62           timeout = 5;
63           disabled = true;
64           shortcut = "lieuext";
65         }
66         { name = "wiby";
67           engine = "xpath";
68           search_url = "https://wiby.me/?q={query}";
69           results_xpath = "//blockquote";
70           url_xpath = ".//a/@href";
71           title_xpath = ".//a";
72           content_xpath = ".//a";
73           categories = "smolweb";
74           timeout = 5;
75           disabled = false;
76           shortcut = "wiby";
77         }
78         { name = "teclis";
79           engine = "xpath";
80           search_url = "https://teclis.com/search?q={query}";
81           results_xpath = "//ul[@class=\"result-items\"]/li[not(@class)]";
82           url_xpath = "./p/a/@href";
83           title_xpath = "./a";
84           content_xpath = "./span";
85           categories = "smolweb";
86           timeout = 5;
87           # disabled = true;
88           shortcut = "teclis";
89         }
90         # { name = "geminispace.info";
91         #   engine = "xpath";
92         #   search_url = "https://teclis.com/search?q={query}";
93         #   results_xpath = "//ul[@class=\"result-items\"]/li";
94         #   url_xpath = "./p/a/@href";
95         #   title_xpath = "./a";
96         #   content_xpath = "./span";
97         #   categories = "smolweb";
98         #   timeout = 10;
99         #   shortcut = "teclis";
100         # }
101       ];
102     };
103   };
104   helpers.webservices."${fqdn}".port = config.services.searx.settings.server.port;
105 }