openclaw: patch brave endpoint in installPhase (postInstall not executed)

This commit is contained in:
2026-02-25 22:05:12 +02:00
parent a292a97d3f
commit 47e31d5090

View File

@@ -6,12 +6,13 @@
let
openclawPatched = inputs.openclaw.packages.${pkgs.system}.openclaw-gateway.overrideAttrs (old: {
postInstall = (old.postInstall or "") + ''
# Point Brave web-search endpoint to local shim
installPhase = old.installPhase + ''
# Point Brave web-search endpoint to local shim.
# NOTE: upstream installPhase script does not run postInstall hooks,
# so patch directly at the end of installPhase.
if [ -d "$out/lib/openclaw/dist" ]; then
# Web-search tool hardcodes Brave endpoint in bundled JS.
# No runtime config option exists for Brave base URL in this OpenClaw version,
# so rewrite it at build-time to local brave-shim.
# No runtime config option exists for Brave base URL in this OpenClaw version.
grep -RIl "https://api.search.brave.com" "$out/lib/openclaw/dist" | while read -r f; do
substituteInPlace "$f" \
--replace "https://api.search.brave.com/res/v1/web/search" "http://127.0.0.1:8000/res/v1/web/search" \