From a56adec49198b45e5ab976ea64a61bbcba3da8c3 Mon Sep 17 00:00:00 2001 From: kx0101 Date: Sun, 23 Aug 2026 16:46:00 +0300 Subject: [PATCH 1/2] reject voxtype on CPUs without AVX2 --- bin/omarchy-voxtype-install | 5 +++ test/shell.d/voxtype-install-test.sh | 61 ++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 test/shell.d/voxtype-install-test.sh diff --git a/bin/omarchy-voxtype-install b/bin/omarchy-voxtype-install index 1fd19f9de6d3..ee677b8c5146 100755 --- a/bin/omarchy-voxtype-install +++ b/bin/omarchy-voxtype-install @@ -7,6 +7,11 @@ set -e # Install voxtype and configure it for use. +if ! grep -qw avx2 /proc/cpuinfo; then + echo "Voxtype Dictation requires AVX2 on this hardware and cannot be installed." >&2 + exit 1 +fi + if gum confirm "Install Voxtype + AI model (~150MB) to enable dictation?"; then omarchy-pkg-add wtype voxtype-bin diff --git a/test/shell.d/voxtype-install-test.sh b/test/shell.d/voxtype-install-test.sh new file mode 100755 index 000000000000..55039b1ad0f6 --- /dev/null +++ b/test/shell.d/voxtype-install-test.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +set -euo pipefail + +source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh" + +test_tmp=$(mktemp -d) +trap 'rm -rf "$test_tmp"' EXIT + +mock_bin="$test_tmp/bin" +call_log="$test_tmp/calls" +mkdir -p "$mock_bin" + +export REAL_GREP +REAL_GREP=$(command -v grep) + +cat >"$mock_bin/grep" <<'SH' +#!/bin/bash +if [[ $* == *"/proc/cpuinfo"* ]]; then + [[ ${OMARCHY_TEST_AVX2:-false} == "true" ]] +else + exec "$REAL_GREP" "$@" +fi +SH + +for command in gum omarchy-pkg-add voxtype hyprctl omarchy-restart-shell omarchy-notification-send; do + cat >"$mock_bin/$command" <<'SH' +#!/bin/bash +printf '%s:%s\n' "$(basename "$0")" "$*" >>"$OMARCHY_TEST_CALL_LOG" +SH +done +cat >"$mock_bin/omarchy-hw-vulkan" <<'SH' +#!/bin/bash +exit 1 +SH +chmod +x "$mock_bin"/* + +if HOME="$test_tmp/home" OMARCHY_PATH="$ROOT" OMARCHY_TEST_CALL_LOG="$call_log" \ + PATH="$mock_bin:$PATH" bash "$ROOT/bin/omarchy-voxtype-install" \ + >"$test_tmp/output" 2>&1; then + fail "Voxtype installer rejects CPUs without AVX2" +fi + +grep -Fq "Voxtype Dictation requires AVX2" "$test_tmp/output" || + fail "Voxtype installer explains the AVX2 requirement" "$(cat "$test_tmp/output")" +[[ ! -s $call_log ]] || + fail "Voxtype installer stops before prompting or installing on an incompatible CPU" "$(cat "$call_log")" +pass "Voxtype installer rejects incompatible CPUs before prompting or installing" + +: >"$call_log" +HOME="$test_tmp/home" OMARCHY_PATH="$ROOT" OMARCHY_TEST_CALL_LOG="$call_log" \ + OMARCHY_TEST_AVX2=true PATH="$mock_bin:$PATH" \ + bash "$ROOT/bin/omarchy-voxtype-install" + +grep -Fq "gum:confirm Install Voxtype + AI model (~150MB) to enable dictation?" "$call_log" || + fail "Voxtype installer still prompts on compatible CPUs" "$(cat "$call_log")" +grep -Fq "omarchy-pkg-add:wtype voxtype-bin" "$call_log" || + fail "Voxtype installer still installs its packages on compatible CPUs" "$(cat "$call_log")" +grep -Fq "voxtype:setup --download --no-post-install" "$call_log" || + fail "Voxtype installer still downloads its model on compatible CPUs" "$(cat "$call_log")" +pass "Voxtype installer keeps the existing setup flow on AVX2 CPUs" From c91a6f18ebc18466f49f4ee58065bc496a677c0e Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Mon, 28 Sep 2026 17:01:05 +0200 Subject: [PATCH 2/2] Keep Voxtype's CPU build on CPUs without AVX2 voxtype-bin 1.1.0 ships a baseline CPU build and selects it when /proc/cpuinfo has no avx2, so refusing the whole install now blocks machines Voxtype runs on. The one step that still lands them on an AVX2-only binary is `voxtype setup gpu --enable`, which switches to the Vulkan build without checking the CPU; only take it when the CPU has AVX2. Co-Authored-By: Claude Opus 5.5 --- bin/omarchy-voxtype-install | 8 ++----- test/shell.d/voxtype-install-test.sh | 32 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bin/omarchy-voxtype-install b/bin/omarchy-voxtype-install index ee677b8c5146..c2b4d6ea48ef 100755 --- a/bin/omarchy-voxtype-install +++ b/bin/omarchy-voxtype-install @@ -7,11 +7,6 @@ set -e # Install voxtype and configure it for use. -if ! grep -qw avx2 /proc/cpuinfo; then - echo "Voxtype Dictation requires AVX2 on this hardware and cannot be installed." >&2 - exit 1 -fi - if gum confirm "Install Voxtype + AI model (~150MB) to enable dictation?"; then omarchy-pkg-add wtype voxtype-bin @@ -20,7 +15,8 @@ if gum confirm "Install Voxtype + AI model (~150MB) to enable dictation?"; then cp "$OMARCHY_PATH/default/voxtype/config.toml" ~/.config/voxtype/ voxtype setup --download --no-post-install - if omarchy-hw-vulkan; then + # Voxtype's Vulkan build needs AVX2; without it the package keeps its baseline CPU build + if omarchy-hw-vulkan && grep -qw avx2 /proc/cpuinfo; then voxtype setup gpu --enable || true fi voxtype setup systemd diff --git a/test/shell.d/voxtype-install-test.sh b/test/shell.d/voxtype-install-test.sh index 55039b1ad0f6..a1512668a61d 100755 --- a/test/shell.d/voxtype-install-test.sh +++ b/test/shell.d/voxtype-install-test.sh @@ -31,21 +31,23 @@ SH done cat >"$mock_bin/omarchy-hw-vulkan" <<'SH' #!/bin/bash -exit 1 +exit 0 SH chmod +x "$mock_bin"/* -if HOME="$test_tmp/home" OMARCHY_PATH="$ROOT" OMARCHY_TEST_CALL_LOG="$call_log" \ - PATH="$mock_bin:$PATH" bash "$ROOT/bin/omarchy-voxtype-install" \ - >"$test_tmp/output" 2>&1; then - fail "Voxtype installer rejects CPUs without AVX2" -fi +HOME="$test_tmp/home" OMARCHY_PATH="$ROOT" OMARCHY_TEST_CALL_LOG="$call_log" \ + PATH="$mock_bin:$PATH" bash "$ROOT/bin/omarchy-voxtype-install" -grep -Fq "Voxtype Dictation requires AVX2" "$test_tmp/output" || - fail "Voxtype installer explains the AVX2 requirement" "$(cat "$test_tmp/output")" -[[ ! -s $call_log ]] || - fail "Voxtype installer stops before prompting or installing on an incompatible CPU" "$(cat "$call_log")" -pass "Voxtype installer rejects incompatible CPUs before prompting or installing" +grep -Fq "omarchy-pkg-add:wtype voxtype-bin" "$call_log" || + fail "Voxtype installer installs its packages on CPUs without AVX2" "$(cat "$call_log")" +grep -Fq "voxtype:setup --download --no-post-install" "$call_log" || + fail "Voxtype installer downloads its model on CPUs without AVX2" "$(cat "$call_log")" +grep -Fq "voxtype:setup systemd" "$call_log" || + fail "Voxtype installer enables its service on CPUs without AVX2" "$(cat "$call_log")" +if grep -Fq "voxtype:setup gpu" "$call_log"; then + fail "Voxtype installer keeps the CPU build on CPUs without AVX2, even with Vulkan" "$(cat "$call_log")" +fi +pass "Voxtype installer keeps the CPU build on CPUs without AVX2" : >"$call_log" HOME="$test_tmp/home" OMARCHY_PATH="$ROOT" OMARCHY_TEST_CALL_LOG="$call_log" \ @@ -53,9 +55,11 @@ HOME="$test_tmp/home" OMARCHY_PATH="$ROOT" OMARCHY_TEST_CALL_LOG="$call_log" \ bash "$ROOT/bin/omarchy-voxtype-install" grep -Fq "gum:confirm Install Voxtype + AI model (~150MB) to enable dictation?" "$call_log" || - fail "Voxtype installer still prompts on compatible CPUs" "$(cat "$call_log")" + fail "Voxtype installer still prompts on AVX2 CPUs" "$(cat "$call_log")" grep -Fq "omarchy-pkg-add:wtype voxtype-bin" "$call_log" || - fail "Voxtype installer still installs its packages on compatible CPUs" "$(cat "$call_log")" + fail "Voxtype installer still installs its packages on AVX2 CPUs" "$(cat "$call_log")" grep -Fq "voxtype:setup --download --no-post-install" "$call_log" || - fail "Voxtype installer still downloads its model on compatible CPUs" "$(cat "$call_log")" + fail "Voxtype installer still downloads its model on AVX2 CPUs" "$(cat "$call_log")" +grep -Fq "voxtype:setup gpu --enable" "$call_log" || + fail "Voxtype installer still enables Vulkan on AVX2 CPUs" "$(cat "$call_log")" pass "Voxtype installer keeps the existing setup flow on AVX2 CPUs"