diff options
author | tdback <tyler@tdback.net> | 2025-01-26 11:34:28 -0500 |
---|---|---|
committer | tdback <tyler@tdback.net> | 2025-01-26 11:34:28 -0500 |
commit | 99e940770b61db350379d692df7cf3831ef4bd92 (patch) | |
tree | d927d171b483b9ae07de4ab615f250edf25e535a /modules/services/searx/default.nix | |
parent | bc7b54af5193f8ac7333ce3f27f414f9a69a80c0 (diff) |
services: major overhaul on service modules
Diffstat (limited to 'modules/services/searx/default.nix')
-rw-r--r-- | modules/services/searx/default.nix | 71 |
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; + }; + }; + }; } |