feat(nix): package the whisper-stt server - #449
Merged
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
The last native component. Without it resolveWhisperServer finds nothing, `openscreen captions` fails and the AI edition's transcription pump never starts. The model is deliberately not packaged. modelManager.ts downloads a GGML file from HuggingFace into userData on first use, checksums it and replaces a stale copy; that is a runtime cache the user owns, and baking a multi-gigabyte blob into the store would be wrong even if the sandbox allowed the download. The awkward part is that the CMakeLists pulls whisper.cpp, cpp-httplib and nlohmann/json with FetchContent at configure time, over a network the build does not have. Patching the CMakeLists was the wrong answer: those pins are deliberate and documented there -- one of them exists because a build once picked up OpenSSL from the host and shipped a binary that died in the Windows loader -- and a nix-only fork of them would drift from what every other platform builds. CMake already provides the override for this, so the three trees are fetched here and handed over through FETCHCONTENT_SOURCE_DIR_<name>, with FETCHCONTENT_FULLY_DISCONNECTED so a missed one fails loudly rather than reaching for the network. fetchurl on pinned tags rather than fetchFromGitHub, which is a trade and not a preference. fetchFromGitHub hashes the unpacked tree and is immune to GitHub re-compressing an archive, but its hash cannot be computed or checked without nix, and there is no nix on the machine this was written on. A tarball hash can be verified by anyone with curl and sha256sum. If a tag is ever re-compressed the build fails closed and the fix is one line. Vulkan is on, matching what scripts/build-whisper-stt.sh selects for Linux. The alternative is a CPU-only binary, which works and is the same class of silent reduction this packaging exists to remove. Nothing is dlopen'd by soname here -- ggml links libvulkan normally -- so unlike the other two derivations no RPATH surgery is needed. OSC_NATIVE_CPU stays off per the CMakeLists' own warning: it compiles for whichever machine ran the build, and a nix package is precisely a thing built once and run elsewhere. Co-Authored-By: Claude <noreply@anthropic.com>
EtienneLescot
force-pushed
the
claude/nix-whisper-stt
branch
from
August 21, 2026 21:21
f375375 to
6f7aa7f
Compare
This was referenced Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Packages
electron/native/whisper-stt, the on-device speech-to-text server behind captions. Without itresolveWhisperServerfinds nothing,openscreen captionsfails, and the AI edition's transcription pump never starts. Last of the three native components #419 listed as deliberately unpackaged.The model is deliberately not packaged.
modelManager.tsdownloads a GGML file from HuggingFace into userData on first use, checksums it, and replaces a stale copy. That is a runtime cache the user owns; baking a multi-gigabyte blob into the store would be wrong even if the sandbox allowed the download.The awkward part, and why the CMakeLists is untouched
CMakeLists.txtpulls whisper.cpp, cpp-httplib and nlohmann/json withFetchContentat configure time — over a network the build does not have.Patching it would have been the wrong answer. Those pins are deliberate and documented in the file: one of them exists because a build once picked up OpenSSL from the host and shipped a binary that died in the Windows loader before
main(). A nix-only fork of that logic would drift from what every other platform builds, which is the failure this whole series has been removing.CMake already provides the override. The three trees are fetched here and handed over through
FETCHCONTENT_SOURCE_DIR_<name>, withFETCHCONTENT_FULLY_DISCONNECTED=ONso a missed one fails loudly rather than reaching for the network.fetchurlon pinned tags, notfetchFromGitHub— a trade, not a preference.fetchFromGitHubhashes the unpacked tree and is immune to GitHub re-compressing an archive, but its hash cannot be computed or checked without nix, and there is none on the machine this was written on. A tarball hash can be verified by anyone:curl -sSL https://github.com/ggml-org/whisper.cpp/archive/refs/tags/v1.9.1.tar.gz | sha256sumIf a tag is ever re-compressed, the build fails closed and the fix is one line.
Choices worth reviewing
Vulkan is on, matching what
scripts/build-whisper-stt.shselects forlinux-x64/linux-arm64. The alternative is a CPU-only binary — it works, and it is the same class of silent reduction this packaging exists to remove. Unlike the other two derivations, nothing isdlopen'd by soname here (ggml links libvulkan normally), so no RPATH surgery is needed. It does add ggml + Vulkan shader compilation to a job already running ~30 minutes.OSC_NATIVE_CPUstays off, per the CMakeLists' own warning: it compiles with-march=nativefor whichever machine ran the build, and a nix package is precisely a thing built once and run elsewhere.Binary and shared objects install into one directory. Not a nix convention, and deliberate: the CMakeLists sets
CMAKE_INSTALL_RPATHto$ORIGIN:$ORIGIN/bin, andscripts/stage-whisper-stt.shlays them out side by side. Splitting them would mean overriding an RPATH the upstream file chose on purpose, for the sake of a directory name.Verified
whisper.cpp-1.9.1,cpp-httplib-0.18.1,json-3.11.3) checked against whatpreConfigureasserts.modelManager.ts, so nothing is needed at build time.flake.nix;meta.mainProgramset forlib.getExe.runblocks passbash -n. The wrapper assertion now covers four components.Not verified, and this one is less certain than #448
Nothing here has been built. Beyond the usual "no nix on this machine", this derivation has more that can only be settled by running it than the PipeWire helper did:
FETCHCONTENT_SOURCE_DIR_*fully satisfies these three declarations, or whether whisper.cpp's own CMake wants git metadata a tarball does not carry.shadercalone satisfiesvulkan-shaders-gen, or whether it needs more of the Vulkan SDK.I would treat a local
nix build .#whisper-sttas worth more than a review pass on this one.🤖 Generated with Claude Code