My NixOS configurations + dotfiles

server/slop: add brave shim user service and patch openclaw brave endpoint

kris.darkworld.download 872df782 d553f10f

verified
+42 -1
+1
hosts/server/configuration.nix
··· 15 15 ./modules/gitea.nix 16 16 ./modules/vaultwarden.nix 17 17 ./slop/openclaw.nix 18 + ./slop/brave.nix 18 19 ]; 19 20 20 21 # gcc. shit breaks. wtf
+26
hosts/server/slop/brave.nix
··· 1 + { pkgs, ... }: 2 + 3 + { 4 + # Local Brave API shim as a user service 5 + systemd.user.services.brave-shim = { 6 + description = "Brave Search API shim (DDGS)"; 7 + wantedBy = [ "default.target" ]; 8 + after = [ "network-online.target" ]; 9 + wants = [ "network-online.target" ]; 10 + 11 + serviceConfig = { 12 + Type = "simple"; 13 + WorkingDirectory = "/home/ocbwoy3/Projects/brave_shim"; 14 + ExecStart = '' 15 + ${pkgs.uv}/bin/uv run \ 16 + --with fastapi \ 17 + --with uvicorn \ 18 + --with ddgs \ 19 + --with pyyaml \ 20 + python brave_shim.py 21 + ''; 22 + Restart = "always"; 23 + RestartSec = "3"; 24 + }; 25 + }; 26 + }
+15 -1
hosts/server/slop/openclaw.nix
··· 4 4 ... 5 5 }: 6 6 7 + let 8 + openclawPatched = inputs.openclaw.packages.${pkgs.system}.openclaw-gateway.overrideAttrs (old: { 9 + postInstall = (old.postInstall or "") + '' 10 + # Point Brave web-search endpoint to local shim 11 + if [ -d "$out/lib/openclaw/dist" ]; then 12 + grep -RIl "https://api.search.brave.com/" "$out/lib/openclaw/dist" | while read -r f; do 13 + substituteInPlace "$f" --replace-fail "https://api.search.brave.com/" "http://127.0.0.1:8000/" 14 + done 15 + fi 16 + ''; 17 + }); 18 + in 7 19 { 8 20 home-manager.sharedModules = [ 9 21 inputs.openclaw.homeManagerModules.openclaw ··· 11 23 12 24 users.users.ocbwoy3 = { 13 25 packages = [ 14 - inputs.openclaw.packages.${pkgs.system}.openclaw-gateway 26 + openclawPatched 15 27 (pkgs.callPackage ./gogcli.nix { }) 28 + pkgs.uv 29 + pkgs.python3 16 30 ]; 17 31 }; 18 32 }