aboutsummaryrefslogtreecommitdiff
path: root/modules/services/searx
diff options
context:
space:
mode:
authortdback <tyler@tdback.net>2025-01-26 11:34:28 -0500
committertdback <tyler@tdback.net>2025-01-26 11:34:28 -0500
commit99e940770b61db350379d692df7cf3831ef4bd92 (patch)
treed927d171b483b9ae07de4ab615f250edf25e535a /modules/services/searx
parentbc7b54af5193f8ac7333ce3f27f414f9a69a80c0 (diff)
services: major overhaul on service modules
Diffstat (limited to 'modules/services/searx')
-rw-r--r--modules/services/searx/default.nix71
1 files changed, 45 insertions, 26 deletions
diff --git a/modules/services/searx/default.nix b/modules/services/searx/default.nix
index 2b4a9d8..f7c00fb 100644
--- a/modules/services/searx/default.nix
+++ b/modules/services/searx/default.nix
@@ -1,33 +1,52 @@
-{ pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib;
let
- port = 8888;
+ cfg = config.modules.services.searx;
in
{
- services.searx = {
- enable = true;
- package = pkgs.searxng;
- environmentFile = "/var/lib/searx/env";
- settings = {
- general = {
- debug = false;
- instance_name = "searx";
- };
- search = {
- safe_search = 1;
- autocomplete = "duckduckgo";
- autocomplete_min = 4;
- default_lang = "en-US";
- };
- server = {
- port = port;
- bind_address = "0.0.0.0";
- secret_key = "@SEARX_SECRET_KEY@";
- public_instance = false;
- image_proxy = true;
- };
- ui.static_use_hash = true;
+ options.modules.services.searx = {
+ enable = mkEnableOption "searx";
+ port = mkOption {
+ default = 8888;
+ type = types.int;
+ };
+ environmentFile = mkOption {
+ default = "/var/lib/searx/env";
+ type = types.str;
};
};
- networking.firewall.allowedTCPPorts = [ port ];
+ config = mkIf cfg.enable {
+ networking.firewall.allowedTCPPorts = [ cfg.port ];
+ services.searx = {
+ enable = true;
+ package = pkgs.searxng;
+ environmentFile = cfg.environmentFile;
+ settings = {
+ general = {
+ debug = false;
+ instance_name = "searx";
+ };
+ server = {
+ port = cfg.port;
+ bind_address = "0.0.0.0";
+ secret_key = "@SEARX_SECRET_KEY@";
+ public_instance = false;
+ image_proxy = true;
+ };
+ search = {
+ safe_search = 1;
+ autocomplete = "duckduckgo";
+ autocomplete_min = 4;
+ default_lang = "en-US";
+ };
+ ui.static_use_hash = true;
+ };
+ };
+ };
}