fix(searxng): tune engine weights, pool, timeouts, add mojeek+stract#607
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughSearXNG configuration enables DuckDuckGo discovery features, switches language selection to automatic, defines engine suspension periods, updates outgoing HTTP settings, and adds Mojeek and Stract engines. ChangesSearXNG configuration
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Lower pool_maxsize 20→8 for single-user + subagent usage - Lower engine suspension times (recaptcha 7d→1d, cf 15d→1d) - Enable autocomplete and favicon_resolver (duckduckgo) - Add mojeek (w=1.0) and stract (w=0.8) engines for result diversity - Add explicit enable_http2 and keepalive_expiry settings
Head branch was pushed to by a user without write access
bac598d to
a404b34
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
hosts/server/nixcloud/search.nix (1)
53-201: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate the SearXNG docs under
docs/The
hosts/server/nixcloud/search.nixchanges don’t appear to be reflected in the docs tree;docs/search.nixis the search site module, not service documentation. Add the matching SearXNG/nixcloud doc update alongside this config change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@hosts/server/nixcloud/search.nix` around lines 53 - 201, Update the relevant SearXNG/nixcloud documentation under docs/ to match the configuration introduced in search.nix, including search settings, suspended_times, UI/outgoing options, plugins, hostname rules, categories, and engines. Do not modify docs/search.nix, since it is the search site module rather than service documentation.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@hosts/server/nixcloud/search.nix`:
- Around line 53-201: Update the relevant SearXNG/nixcloud documentation under
docs/ to match the configuration introduced in search.nix, including search
settings, suspended_times, UI/outgoing options, plugins, hostname rules,
categories, and engines. Do not modify docs/search.nix, since it is the search
site module rather than service documentation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 219cc61e-6414-4d5f-b651-ec5a3936f53a
📒 Files selected for processing (1)
hosts/server/nixcloud/search.nix
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: CodeRabbit
🧰 Additional context used
📓 Path-based instructions (3)
**/*.nix
📄 CodeRabbit inference engine (.opencode/skills/code-style-nix)
**/*.nix: Follow Nix code style conventions and best practices
Use consistent indentation and formatting in Nix configuration files
Follow established patterns for module organization in home-manager configurations
**/*.nix: Format code and check syntax usingnix fmt
Evaluate Nix expressions without building usingnix evalwith the target configuration path
Format specific Nix files or directories usingnix fmtfollowed by the file or directory path
Use--show-traceflag withnix buildornix evalcommands to diagnose evaluation errors
For infinite recursion errors in Nix builds, check for circular imports or conflicting option definitions
**/*.nix: Usebuiltins.traceto add trace statements and inspect values during Nix evaluation (format:builtins.trace "message: ${toString var}" var)
Usebuiltins.toJSONto convert complex Nix attribute sets to JSON for easier inspection during evaluation
Check for circular imports between modules and option definitions that depend on themselves to resolve infinite recursion errors
Verify attribute names are correct and imports are complete when debugging 'attribute not found' errors in Nix
Check option type definitions and ensure provided values match the expected type to resolve type mismatch errors
Read assertion messages and provide required configuration values when assertion failures occur in NixOS modules
**/*.nix: Store sensitive data insecrets.yamlencrypted with sops instead of hardcoding passwords, API keys, or tokens in plain text
Declare sops secrets with properowner,group, andmodeattributes; use restrictive modes like0400for secrets files
SetrestartUnitsorreloadUnitsfor sops secrets declarations so services that depend on secrets are restarted when secrets change
Useconfig.sops.placeholderin sops templates instead of directly interpolating secret paths in multi-secret templates
Do not pass secrets as environment variables in plain Nix; useenvironmentFileor...
Files:
hosts/server/nixcloud/search.nix
hosts/server/**/*.nix
📄 CodeRabbit inference engine (.opencode/skills/project-structure/SKILL.md)
Server machine-specific NixOS configs should be placed in
hosts/server/<machine>/
Files:
hosts/server/nixcloud/search.nix
hosts/**/*.nix
📄 CodeRabbit inference engine (.opencode/skills/modules/SKILL.md)
Enable NixOS modules in host configuration using the module's declared option, such as
services.myService.enable = true.
Files:
hosts/server/nixcloud/search.nix
🧠 Learnings (5)
📚 Learning: 2026-04-13T14:02:32.760Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 546
File: hosts/server/nixdev/default.nix:18-18
Timestamp: 2026-04-13T14:02:32.760Z
Learning: When configuring NixOS Docker via `virtualisation.docker.daemon.settings`, it is valid to set `storage-driver = "overlayfs"` (do not flag it as an invalid Docker storage-driver). Use `overlayfs` specifically for Docker Engine 29+ and/or when the containerd snapshotter integration is enabled (`virtualisation.docker.features.containerd-snapshotter = true`). Treat this as the containerd snapshotter name for OverlayFS, distinct from the legacy `overlay2` classic Docker storage driver.
Applied to files:
hosts/server/nixcloud/search.nix
📚 Learning: 2026-05-01T10:02:55.261Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 544
File: modules/nixos/core/sops.nix:49-53
Timestamp: 2026-05-01T10:02:55.261Z
Learning: In this nix-config repo, when declaring `sops.secrets` in Nix files, avoid explicitly setting `owner = "root"` and/or `group = "root"` if the intended ownership is root. `sops-nix` defaults `sops.secrets` to `root:root`, so adding these fields explicitly is redundant boilerplate.
Applied to files:
hosts/server/nixcloud/search.nix
📚 Learning: 2026-05-01T14:14:49.691Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 544
File: modules/nixos/core/gaming.nix:119-119
Timestamp: 2026-05-01T14:14:49.691Z
Learning: When configuring the NixOS `wivrn` module option `services.wivrn.config.json.application`, pass the raw package/derivation (e.g., `pkgs.wayvr`) rather than converting it to a string executable path (e.g., `lib.getExe pkgs.wayvr`). The upstream module expects a list of derivations/packages (it internally `toList`s the value, asserts the first element is a derivation, and then resolves the executable internally). Code review should not recommend changing `pkgs.wayvr` to `lib.getExe pkgs.wayvr` for this option.
Applied to files:
hosts/server/nixcloud/search.nix
📚 Learning: 2026-05-20T13:12:46.610Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 546
File: docs/site.nix:127-127
Timestamp: 2026-05-20T13:12:46.610Z
Learning: In DaRacci/nix-config, treating `passthru.discovery = false` as a known repo-wide convention to exclude a derivation from automated flake discovery/package CI. Do not require or flag an inline explanatory comment specifically for the absence of a comment when `passthru.discovery = false` is set.
Applied to files:
hosts/server/nixcloud/search.nix
📚 Learning: 2026-06-28T05:00:06.970Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 599
File: hosts/server/nixai/mnemosyne.nix:6-11
Timestamp: 2026-06-28T05:00:06.970Z
Learning: In this repo’s Nix host configuration, for `sops.secrets.<name>` declarations managed by `sops-nix`, avoid explicitly setting `mode = "0400"` when you are not overriding `sops-nix`’s default secret permissions. `sops-nix` already defaults decrypted secret files to root ownership with mode `0400`, so an explicit `mode = "0400"` is typically redundant. Only set `mode` when you truly need non-default permissions (or you have config that changes the module defaults).
Applied to files:
hosts/server/nixcloud/search.nix
🔇 Additional comments (4)
hosts/server/nixcloud/search.nix (4)
53-56: Discovery settings look good.Enabling DuckDuckGo autocomplete and favicon resolution, switching
default_langto"auto", and settingautocomplete_min = 4are all sensible choices for a single-user instance. The 4-character minimum reduces unnecessary autocomplete requests.
66-76: Suspension times are well-tuned for a private instance.The comment clearly explains the rationale — defaults of 7–15 days for captcha/access-denied are excessive when you control the instance. The chosen values (1 hour for generic captcha, 30 min for rate limits, 24 hours for Cloudflare/recaptcha variants) provide a good balance between giving engines time to recover and not leaving them suspended for unnecessarily long periods.
97-99: Outgoing pool settings align with PR objectives.
pool_maxsize = 8is appropriate for a single-user instance (reducing from 20),enable_http2 = trueimproves connection efficiency, andkeepalive_expiry = 5.0matches the stated 5-second target.
157-201: Engine weights and new entries are consistent with stated objectives.Weights match the commit summary: Bing 0.5, DuckDuckGo 1.2, Google 1.5, Brave 1.2, Startpage 1.3. Mojeek (1.0) and Stract (0.8) are properly configured with list-format
categories = [ "general" ], consistent with the other engine entries. Stract's lower weight is reasonable given it's a newer, less established engine.
Summary
Tune SearXNG configuration for a single-user instance behind Cloudflare Tunnel, primarily consumed by AI agent search tools (Hermes, Open WebUI).
Changes
Performance / Connection Tuning
pool_maxsize: 20 → 8 (20 keep-alive connections per engine is excessive for single-user; 8 handles concurrent subagent searches comfortably)enable_http2: now explicit (true)keepalive_expiry: now explicit (5.0s)Engine Suspension Times
Defaults were absurd for a private instance (recaptcha: 7 days, cloudflare: 15 days). Reduced:
recaptcha_SearxEngineCaptcha: 604800s → 86400s (1 day)cf_SearxEngineCaptcha: 1296000s → 86400s (1 day)cf_SearxEngineAccessDenied: 86400s → 3600s (1 hour)SearxEngineCaptcha: 86400s → 3600s (1 hour)SearxEngineTooManyRequests: 3600s → 1800s (30 min)New Engines
QoL
autocomplete = "duckduckgo"(was disabled)favicon_resolver = "duckduckgo"(was commented out)Not Changed
public_instancestaysfalse— this controls searx.space listing and public instance badges, not reachabilitylink_tokenstaysfalse— would throttle API consumers (Hermes subagents, Open WebUI) that don't go through the HTML UIimage_proxynot enabled — unnecessary memory/bandwidth cost for solo user