Add OpenSuperWhisper local voice input

Install the opensuperwhisper cask and add home.activation.openSuperWhisper
to download the Whisper V3 Large turbo model once, verify its SHA256, and
set the app defaults. Model and defaults stay outside the Nix store; macOS
TCC grants remain manual. Document first-run steps, permissions, and the
default shortcut in readme.md and AGENTS.md.
This commit is contained in:
Lap Tran committed 2026-10-24 15:30:10 -04:00
1 parent 7603df3666
commit 4a4ce6c585
4 files changed
+61

No files matched your search

+42
View File
@@ -401,4 +401,46 @@ in
# Ensure daemon running (launchd on macOS)
"$bin" daemon restart >/dev/null 2>&1 || "$bin" daemon start >/dev/null 2>&1 || true
'';
# OpenSuperWhisper - local voice-first prompting (cask in configuration.nix).
# The app reads its model from its own Application Support directory, so the
# 1.6 GB Whisper model is downloaded here once and kept outside the Nix store.
# A failed download must not fail the switch: warn, drop the partial file, and
# let the app's Settings download it later. Never write hasCompletedOnboarding -
# onboarding must still run so the captain can grant Microphone/Accessibility
# (macOS TCC grants are manual by design). A running app picks up new defaults
# on its next launch; do not kill it here.
home.activation.openSuperWhisper = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
supportDir="$HOME/Library/Application Support/ru.starmel.OpenSuperWhisper"
modelDir="$supportDir/whisper-models"
modelPath="$modelDir/ggml-large-v3-turbo.bin"
modelUrl="https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin?download=true"
modelSha="1fc70f774d38eb169993ac391eea357ef47c88757ef72ee5943879b7e8e2bc69"
curl="${pkgs.curl}/bin/curl"
mkdir -p "$modelDir"
if [ ! -f "$modelPath" ]; then
tmp="$(${pkgs.coreutils}/bin/mktemp "$modelDir/.ggml-large-v3-turbo.XXXXXX")"
if "$curl" -fL --retry 3 --connect-timeout 30 -o "$tmp" "$modelUrl" \
&& printf '%s %s\n' "$modelSha" "$tmp" | ${pkgs.coreutils}/bin/sha256sum -c - >/dev/null 2>&1; then
mv "$tmp" "$modelPath"
else
echo "openSuperWhisper: WARNING: could not download or verify the Whisper model." >&2
echo "openSuperWhisper: the app still works; download \"Whisper V3 Large\" in Settings later." >&2
${pkgs.coreutils}/bin/rm -f "$tmp"
fi
fi
defaults=/usr/bin/defaults
"$defaults" write ru.starmel.OpenSuperWhisper selectedEngine -string whisper
"$defaults" write ru.starmel.OpenSuperWhisper whisperLanguage -string en
"$defaults" write ru.starmel.OpenSuperWhisper autoPasteTranscription -bool true
"$defaults" write ru.starmel.OpenSuperWhisper holdToRecord -bool true
"$defaults" write ru.starmel.OpenSuperWhisper addSpaceAfterSentence -bool true
"$defaults" write ru.starmel.OpenSuperWhisper startHiddenInMenuBar -bool true
if [ -f "$modelPath" ]; then
"$defaults" write ru.starmel.OpenSuperWhisper selectedWhisperModelPath -string "$modelPath"
fi
'';
}