mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
* add fluid speech pro to the speech model catalog FluidVoice's Fluid Speech Pro, a Parakeet TDT 0.6B v3 retrain that also declares Moondream's Parakeet Ultra as a base, for the same 25 European languages. TalkMate converted it to a Q8_0 transcribe.cpp GGUF at d59dc79 (741,819,456 bytes, sha256 c3848e98...); the file says parakeet/tdt-0.6b-fluid-speech-pro and announces its extra pre-Conformer block as stt.parakeet.encoder.pre_block_kernel, so it needs a transcribe.cpp that reads enc.pre_block. Like Parakeet v3 it takes no language hint, detects the language under Auto, does not stream, and is never recommended or badged. Its card publishes no LibriSpeech test-clean figure, so it carries no single word error rate and no benchmark record; its per-language FLEURS figures and the CC BY 4.0 credit are in its details. * bump(transcribe.cpp): 295c7e6, fluid speech pro's pre-conformer block Fluid Speech Pro's GGUF announces stt.parakeet.encoder.pre_block_kernel and carries eight enc.pre_block.* tensors: a residual FrameCleaner block between the subsampler and Conformer layer 0. The old pin's graph never read them, so the model loaded as plain Parakeet v3 and its encoder was wrong. Both transcribe-cpp crates move to 295c7e601 on hex/combined-fluid, a fast-forward of bcb639f that runs the block on pre_encode before xscaling when the KV is present, and fails the load rather than skipping tensors when it is only partly there. Cargo.lock changes only those two sources (`getrandom`'s tempfile pointer was reverted to what it was), and nix/package.nix carries the hash from a failed `nix build .#hex`, then a full one whose check phase passed. `hex model install fluid-speech-pro` followed by `hex model transcribe` on whisper.cpp's jfk.wav prints the expected sentence, as does Parakeet v3 on the same clip. * fluid speech pro: snake_case id, FLEURS-only figures, blurb, notices
298 lines
9.3 KiB
Nix
298 lines
9.3 KiB
Nix
{
|
|
lib,
|
|
rustPlatform,
|
|
pkg-config,
|
|
cmake,
|
|
python3,
|
|
shaderc,
|
|
vulkan-headers,
|
|
vulkan-loader,
|
|
spirv-headers,
|
|
openblas,
|
|
alsa-lib,
|
|
alsa-plugins,
|
|
pipewire,
|
|
libva,
|
|
ffmpeg-headless,
|
|
openssl,
|
|
libxkbcommon,
|
|
wayland,
|
|
fontconfig,
|
|
freetype,
|
|
curl,
|
|
util-linux,
|
|
wl-clipboard,
|
|
wtype,
|
|
makeWrapper,
|
|
autoAddDriverRunpath,
|
|
symlinkJoin,
|
|
libx11,
|
|
libxcb,
|
|
libxcursor,
|
|
libxrandr,
|
|
libxi,
|
|
mkShell,
|
|
rust-analyzer,
|
|
rustfmt,
|
|
clippy,
|
|
}:
|
|
|
|
let
|
|
buildEnv = {
|
|
OPENSSL_NO_VENDOR = "1";
|
|
BLA_VENDOR = "OpenBLAS";
|
|
};
|
|
runtimeEnv = {
|
|
LD_LIBRARY_PATH = lib.makeLibraryPath [
|
|
vulkan-loader
|
|
openblas
|
|
alsa-lib
|
|
wayland
|
|
libxkbcommon
|
|
fontconfig
|
|
# The X11 window and its XWayland overlay dlopen their libraries, so no
|
|
# DT_NEEDED entry finds them: x11rb's `dl-libxcb` loads libxcb.so.1, and
|
|
# winit's X11 backend loads libX11.so.6, libXcursor.so.1, libXi.so.6 and
|
|
# libX11-xcb.so.1 (in libx11), plus libxkbcommon-x11 (in libxkbcommon).
|
|
libxcb
|
|
libx11
|
|
libxcursor
|
|
libxi
|
|
# Linux Annotate dlopens libpipewire-0.3, libva and libva-drm. libva finds VA-API
|
|
# drivers through its built-in /run/opengl-driver path or LIBVA_DRIVERS_PATH.
|
|
pipewire
|
|
libva
|
|
];
|
|
ALSA_PLUGIN_DIR = symlinkJoin {
|
|
name = "hex-alsa-plugins";
|
|
paths = [
|
|
"${pipewire}/lib/alsa-lib"
|
|
"${alsa-plugins}/lib/alsa-lib"
|
|
];
|
|
};
|
|
};
|
|
runtimePackages = [
|
|
curl
|
|
wl-clipboard
|
|
wtype
|
|
# Annotate runs ffmpeg and ffprobe; the headless build includes libx264.
|
|
ffmpeg-headless
|
|
];
|
|
# Every Git dependency Cargo.lock pins, with the revision its output hash was
|
|
# computed from. scripts/check-nix-git-pins.py fails a pull request that bumps
|
|
# one without the other, before Nix reports a hash mismatch.
|
|
cargoGitDependencies = {
|
|
"transcribe-rs-0.3.11" = {
|
|
rev = "e37c66b6df43af51fde8dec34f98a07aaf09564c";
|
|
hash = "sha256-MJJiug3LfbKsuHcL2+LJk95+j5kk/MWzb5ihdBlHLmE=";
|
|
};
|
|
"rune-0.0.1" = {
|
|
rev = "c853811c8e0e60a632eaa2e72992f871225737ef";
|
|
hash = "sha256-0yJb+UFu47T2pgDIi9B9IAxbCWNu0/OMVG5uGNF6lyI=";
|
|
};
|
|
"transcribe-cpp-sys-0.4.1" = {
|
|
rev = "295c7e601ee5a25da0d1f169c996aee839d49943";
|
|
hash = "sha256-tQtKhTAO7bSdPov7hq8jRdujFJgMwAw5yHuwaErNPss=";
|
|
};
|
|
};
|
|
# The vendor tree names every Git crate `<name>-<version>`, so the rune
|
|
# package's directory follows its key in the table above.
|
|
runeVendor = builtins.head (
|
|
builtins.filter (name: lib.hasPrefix "rune-" name) (builtins.attrNames cargoGitDependencies)
|
|
);
|
|
in
|
|
rustPlatform.buildRustPackage (finalAttrs: {
|
|
pname = "hex";
|
|
version = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).package.version;
|
|
|
|
src = lib.fileset.toSource {
|
|
root = ../.;
|
|
fileset = lib.fileset.unions [
|
|
../Cargo.toml
|
|
../Cargo.lock
|
|
../.cargo
|
|
../build.rs
|
|
../crates
|
|
../src
|
|
../tests
|
|
../native
|
|
../resources
|
|
../assets
|
|
../packaging
|
|
# The Labs registry's published copy: a Rust test compares it to the registry.
|
|
../site/src/labs.json
|
|
../macos/HexMicrophoneDriver/Info.plist
|
|
# Built in: a 2.3.1 install moves itself into this installer's layout.
|
|
../.github/release/install-linux.sh
|
|
];
|
|
};
|
|
|
|
# nixpkgs' vendor directory keeps every crate in one place, keyed by name and
|
|
# version, so it cannot hold two copies from different sources. Rune's
|
|
# `vendor/tiny-skia-path` is a path dependency inside Rune (a Git crate here)
|
|
# at 0.11.4, the same name and version as resvg's from crates.io, so this
|
|
# vendors crates.io's crates in `registry/` and every Git source's crates in
|
|
# `git/`, and points each source at its own directory: Cargo tells them apart
|
|
# by source. The script is importCargoLock's, rewritten; each fragment below
|
|
# must still be in it (the guard says which is gone), so a nixpkgs change
|
|
# fails loudly here instead of vendoring something wrong.
|
|
cargoDeps =
|
|
(rustPlatform.importCargoLock {
|
|
lockFile = ../Cargo.lock;
|
|
outputHashes = builtins.mapAttrs (_: dependency: dependency.hash) cargoGitDependencies;
|
|
}).overrideAttrs
|
|
(old: {
|
|
buildCommand =
|
|
let
|
|
# importCargoLock's script, and what this override turns it into.
|
|
fragments = [
|
|
{
|
|
what = "the single vendored-sources config";
|
|
from = ''
|
|
[source.crates-io]
|
|
replace-with = "vendored-sources"
|
|
|
|
[source.vendored-sources]
|
|
directory = "cargo-vendor-dir"'';
|
|
to = ''
|
|
[source.crates-io]
|
|
replace-with = "registry-vendor-dir"
|
|
|
|
[source.registry-vendor-dir]
|
|
directory = "cargo-vendor-dir/registry"
|
|
|
|
[source.git-vendor-dir]
|
|
directory = "cargo-vendor-dir/git"'';
|
|
}
|
|
{
|
|
what = "the one-directory crate link";
|
|
from = ''ln -s "$crate" $out/$(basename "$crate" | cut -c 34-)'';
|
|
to = ''
|
|
dest=$(basename "$crate" | cut -c 34-)
|
|
if [ -e "$crate/.cargo-config" ]; then
|
|
mkdir -p $out/git
|
|
ln -s "$crate" $out/git/$dest
|
|
else
|
|
mkdir -p $out/registry
|
|
ln -s "$crate" $out/registry/$dest
|
|
fi'';
|
|
}
|
|
{
|
|
what = "the Git source config append";
|
|
from = ''cat "$crate/.cargo-config" >> $out/.cargo/config.toml'';
|
|
to = ''sed 's/replace-with = "vendored-sources"/replace-with = "git-vendor-dir"/' "$crate/.cargo-config" >> $out/.cargo/config.toml'';
|
|
}
|
|
];
|
|
missing = builtins.filter (fragment: !(lib.hasInfix fragment.from old.buildCommand)) fragments;
|
|
in
|
|
if missing != [ ] then
|
|
throw (
|
|
"nix/package.nix: importCargoLock's vendor script changed; re-apply the split into "
|
|
+ "a registry and a Git vendor directory. Missing: "
|
|
+ lib.concatMapStringsSep ", " (fragment: fragment.what) missing
|
|
)
|
|
else
|
|
lib.replaceStrings (map (fragment: fragment.from) fragments) (map (
|
|
fragment: fragment.to
|
|
) fragments) old.buildCommand
|
|
+ "\n"
|
|
+ ''
|
|
# Rune's `crates/rune-text` loads its default fonts from
|
|
# `crates/rune/assets` through a path relative to Rune's
|
|
# workspace root (`../../../rune/assets/…`). A vendored crate
|
|
# sits in `git/` beside the rune package, not inside that
|
|
# workspace, so point that path at the rune package's own
|
|
# assets. Drop this once Rune moves the fonts into rune-text.
|
|
mkdir -p $out/git
|
|
rune_vendor=${runeVendor}
|
|
if [ ! -d "$out/git/$rune_vendor/assets" ]; then
|
|
echo "nix/package.nix: $out/git/$rune_vendor/assets is missing; rune-text's font include needs it" >&2
|
|
exit 1
|
|
fi
|
|
ln -sfn "$rune_vendor" $out/git/rune
|
|
'';
|
|
});
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
cmake
|
|
python3
|
|
shaderc
|
|
makeWrapper
|
|
autoAddDriverRunpath
|
|
];
|
|
buildInputs = [
|
|
vulkan-headers
|
|
vulkan-loader
|
|
spirv-headers
|
|
openblas
|
|
alsa-lib
|
|
openssl
|
|
libxkbcommon
|
|
wayland
|
|
fontconfig
|
|
freetype
|
|
libx11
|
|
libxcb
|
|
libxcursor
|
|
libxrandr
|
|
libxi
|
|
];
|
|
|
|
# OpenCode HTTP requests run through curl, including in the tests; the
|
|
# 2.3.1 adoption test runs the Linux installer, which needs flock.
|
|
nativeCheckInputs = [
|
|
curl
|
|
util-linux
|
|
];
|
|
|
|
dontUseCmakeConfigure = true;
|
|
env = buildEnv;
|
|
# Desktop and installed-model tests are #[ignore]; run the remaining suite.
|
|
doCheck = true;
|
|
# Hex's suite keeps process-global state (the lab switches, a model download
|
|
# in flight), while CI and `scripts/check` run nextest, which isolates each
|
|
# test in its own process. Plain `cargo test` shares one process, so let
|
|
# cargoCheckHook run it one test at a time (it sets RUST_TEST_THREADS=1).
|
|
dontUseCargoParallelTests = true;
|
|
preCheck = ''
|
|
export HOME="$TMPDIR/hex-test-home"
|
|
mkdir -p "$HOME"
|
|
'';
|
|
|
|
postInstall = ''
|
|
install -Dm644 ${../packaging/anomaly.hex.desktop} $out/share/applications/anomaly.hex.desktop
|
|
mkdir -p $out/share/icons
|
|
cp -R ${../packaging/linux/icons/hicolor} $out/share/icons/hicolor
|
|
substituteInPlace $out/share/applications/anomaly.hex.desktop \
|
|
--replace-fail '@HEX_BIN@' "$out/bin/hex"
|
|
'';
|
|
|
|
postFixup = ''
|
|
wrapProgram $out/bin/hex \
|
|
--prefix PATH : ${lib.makeBinPath runtimePackages} \
|
|
--prefix LD_LIBRARY_PATH : ${runtimeEnv.LD_LIBRARY_PATH} \
|
|
--set ALSA_PLUGIN_DIR ${runtimeEnv.ALSA_PLUGIN_DIR}
|
|
'';
|
|
|
|
passthru.devShell = mkShell {
|
|
inputsFrom = [ finalAttrs.finalPackage ];
|
|
env = buildEnv // runtimeEnv;
|
|
packages = runtimePackages ++ [
|
|
rust-analyzer
|
|
rustfmt
|
|
clippy
|
|
];
|
|
};
|
|
|
|
meta = {
|
|
description = "Local-first voice dictation (Linux beta)";
|
|
homepage = "https://anoma.ly/hex/";
|
|
license = lib.licenses.mit;
|
|
mainProgram = "hex";
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
};
|
|
})
|