diff --git a/nixos/docs/darwin-post-deploy.md b/nixos/docs/darwin-post-deploy.md index 791cfa31..75dc3883 100644 --- a/nixos/docs/darwin-post-deploy.md +++ b/nixos/docs/darwin-post-deploy.md @@ -24,6 +24,15 @@ Run these tasks after initial deployment on a new Mac. - [ ] Clone notes repo: `git clone git@github.com:/notes.git ~/Notes` - [ ] Clone other personal repos as needed +## Frigate ANE Detector (dungeon only) +The `frigate-detector` launchd agent (hosts/macs/dungeon/default.nix) runs the native +Apple-Silicon object detector that Frigate connects to over ZMQ. It is not auto-cloned: +- [ ] `git clone https://github.com/frigate-nvr/apple-silicon-detector ~/Git/apple-silicon-detector` +- [ ] `cd ~/Git/apple-silicon-detector && /opt/homebrew/bin/python3.11 -m venv venv` +- [ ] `./venv/bin/pip3 install -r requirements.txt` +- [ ] Re-run `darwin-rebuild switch` so the agent finds the venv, then verify: + `tail ~/Library/Logs/frigate-detector.log` shows "ZMQ server successfully bound to tcp://*:5555" + ## Launch Applications - [ ] Set up AeroSpace tiling diff --git a/nixos/hosts/macs/dungeon/default.nix b/nixos/hosts/macs/dungeon/default.nix index 3a181538..9a9eebf6 100644 --- a/nixos/hosts/macs/dungeon/default.nix +++ b/nixos/hosts/macs/dungeon/default.nix @@ -346,4 +346,31 @@ StandardErrorPath = "/Users/${vars.user.name}/Library/Logs/mac-battery-textfile.log"; }; }; + + # --------------------------------------------------------------------------- + # Frigate object detection on the Apple Neural Engine. + # Frigate runs in OrbStack's Linux VM, which can't reach the ANE — so the + # detector (frigate-nvr/apple-silicon-detector) runs NATIVELY here and Frigate + # connects from the container over ZMQ/TCP (config: detectors.type=zmq, + # endpoint=tcp://host.docker.internal:5555). This moves the single biggest + # CPU consumer (CPU inference was ~64% of Frigate's load) onto the Neural + # Engine. Run in AUTO mode: Frigate ships the yolov9 model over ZMQ on connect. + # Manual one-time install (not auto-cloned — see darwin-post-deploy.md): + # git clone https://github.com/frigate-nvr/apple-silicon-detector ~/Git/apple-silicon-detector + # cd ~/Git/apple-silicon-detector && /opt/homebrew/bin/python3.11 -m venv venv + # ./venv/bin/pip3 install -r requirements.txt + launchd.user.agents.frigate-detector = { + serviceConfig = { + ProgramArguments = [ + "/Users/${vars.user.name}/Git/apple-silicon-detector/venv/bin/python3" + "-u" + "/Users/${vars.user.name}/Git/apple-silicon-detector/detector/zmq_onnx_client.py" + ]; + WorkingDirectory = "/Users/${vars.user.name}/Git/apple-silicon-detector"; + RunAtLoad = true; + KeepAlive = true; + StandardOutPath = "/Users/${vars.user.name}/Library/Logs/frigate-detector.log"; + StandardErrorPath = "/Users/${vars.user.name}/Library/Logs/frigate-detector.log"; + }; + }; }