mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
feat(vinput): drop NPU/OpenVINO support (#384)
Vinput's streaming Zipformer models have unbounded dynamic shapes, so OpenVINO cannot compile them for the GPU or the NPU; the `openvino` provider and ai's Intel NPU enablement could never run on the NPU (noted as unverified in WORKAROUNDS WA-017). Remove the backend option, the daemon's OpenVINO library path, and the intel-npu module enable, and update the eval test, README and WORKAROUNDS (drop WA-016 and WA-017). Keep Vinput's stock package and its bundled sherpa-onnx (1.13.4): the fork-based and nixpkgs-master sherpa overrides existed only to provide the `openvino` provider, so drop package.nix with them. Assisted-by: opencode (DeepSeek V4.1 Flash)
This commit is contained in:
1 parent
50a4182898
commit
6b8c5bfae4
9 files changed
+14
-111
No files matched your search
+9
-11
@@ -16,16 +16,15 @@ obsolete workarounds get rolled back instead of lingering.
|
||||
|
||||
A version or revision pinned for a reason that can go away.
|
||||
|
||||
| ID | What & where | Why | Removal condition | Added | Revisit | Status |
|
||||
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------------------- | ------ |
|
||||
| WA-001 | smartctl_exporter pinned to upstream `6274decc`, which carries PR [#329](https://github.com/prometheus-community/smartctl_exporter/pull/329) — `overlays/smartctl-exporter/` | `/metrics` returns HTTP 500 once a device becomes readable after startup ([#305](https://github.com/prometheus-community/smartctl_exporter/issues/305), [#326](https://github.com/prometheus-community/smartctl_exporter/issues/326)) | Drop once nixpkgs provides a version containing the #329 fix | 2026-10-03 | next nixpkgs bump | active |
|
||||
| WA-002 | `nixpkgs-2505` — `flake.nix`; consumer `home/base/tui/container.nix` | `kubernetes-helm` regressed in newer nixpkgs | Drop the input and its consumer once helm works again in current nixpkgs | 2025-12-03 | when helm is revisited | active |
|
||||
| WA-003 | `rust-overlay` follow — `flake.nix` | lanzaboote v1.1.0's pinned rust-overlay uses the deprecated `stdenv.isLinux`/`stdenv.isDarwin` | Drop the follow once lanzaboote updates its pin (or we drop the lanzaboote pin) | 2026-09-25 | on lanzaboote bump | active |
|
||||
| WA-004 | `catppuccin` on `main` — `flake.nix` | `main` carries the nodejs→nodejs-slim deprecation fix, which is not in a release | Switch to a release tag once it includes the fix | 2026-09-25 | on catppuccin release | active |
|
||||
| WA-005 | `tuios` input — `flake.nix`; `home/base/tui/tuios/` | nixpkgs lags behind upstream | Use nixpkgs' `tuios` once it is recent enough | 2026-10-03 | on nixpkgs bump | active |
|
||||
| WA-006 | `nixpkgs-blender` — `flake.nix` | Blender 5.2 LTS + CUDA/OptiX pin; keeps `just up` from triggering a full source rebuild | Bump deliberately when needed; drop the pin if the current nixpkgs build is acceptable | 2026-07-24 | deliberate | active |
|
||||
| WA-007 | WeChat from `nixpkgs-master` — `hardening/bwraps/default.nix` | newest builds; the pinned channel lags | Fall back to the stable channel once it has a good build | 2026-10-03 | on nixpkgs bump | active |
|
||||
| WA-016 | Sherpa-ONNX 1.13.8 override and Nix CMake patches — `flake.nix`, `home/linux/gui/base/vinput/package.nix` | Vinput pins Sherpa 1.13.4, which does not recognize the `openvino` provider; newer upstream source needs Nix-compatible dependency linking | Drop the override and carried patches once Vinput's Sherpa dependency is at least 1.13.8 and builds with upstream Nix patches | 2026-10-04 | on Vinput or Sherpa update | active |
|
||||
| ID | What & where | Why | Removal condition | Added | Revisit | Status |
|
||||
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ---------- | ---------------------- | ------ |
|
||||
| WA-001 | smartctl_exporter pinned to upstream `6274decc`, which carries PR [#329](https://github.com/prometheus-community/smartctl_exporter/pull/329) — `overlays/smartctl-exporter/` | `/metrics` returns HTTP 500 once a device becomes readable after startup ([#305](https://github.com/prometheus-community/smartctl_exporter/issues/305), [#326](https://github.com/prometheus-community/smartctl_exporter/issues/326)) | Drop once nixpkgs provides a version containing the #329 fix | 2026-10-03 | next nixpkgs bump | active |
|
||||
| WA-002 | `nixpkgs-2505` — `flake.nix`; consumer `home/base/tui/container.nix` | `kubernetes-helm` regressed in newer nixpkgs | Drop the input and its consumer once helm works again in current nixpkgs | 2025-12-03 | when helm is revisited | active |
|
||||
| WA-003 | `rust-overlay` follow — `flake.nix` | lanzaboote v1.1.0's pinned rust-overlay uses the deprecated `stdenv.isLinux`/`stdenv.isDarwin` | Drop the follow once lanzaboote updates its pin (or we drop the lanzaboote pin) | 2026-09-25 | on lanzaboote bump | active |
|
||||
| WA-004 | `catppuccin` on `main` — `flake.nix` | `main` carries the nodejs→nodejs-slim deprecation fix, which is not in a release | Switch to a release tag once it includes the fix | 2026-09-25 | on catppuccin release | active |
|
||||
| WA-005 | `tuios` input — `flake.nix`; `home/base/tui/tuios/` | nixpkgs lags behind upstream | Use nixpkgs' `tuios` once it is recent enough | 2026-10-03 | on nixpkgs bump | active |
|
||||
| WA-006 | `nixpkgs-blender` — `flake.nix` | Blender 5.2 LTS + CUDA/OptiX pin; keeps `just up` from triggering a full source rebuild | Bump deliberately when needed; drop the pin if the current nixpkgs build is acceptable | 2026-07-24 | deliberate | active |
|
||||
| WA-007 | WeChat from `nixpkgs-master` — `hardening/bwraps/default.nix` | newest builds; the pinned channel lags | Fall back to the stable channel once it has a good build | 2026-10-03 | on nixpkgs bump | active |
|
||||
|
||||
## Workarounds
|
||||
|
||||
@@ -51,7 +50,6 @@ A known limitation with no fix yet.
|
||||
| WA-012 | `muvm` (x86_64 apps/games via microVM) disabled — `hosts/12kingdoms-shoukei/apple-silicon.nix` | Apple Silicon's 16k page size means x86_64 apps need `muvm`; it is off because it does not build/run on nixos-apple-silicon yet ([nixos-apple-silicon#237](https://github.com/nix-community/nixos-apple-silicon/issues/237)) | Re-enable once `muvm` builds and works | — | on nixos-apple-silicon or muvm updates | active |
|
||||
| WA-015 | Darwin secret ownership — `secrets/darwin.nix` | Blanket `chown /etc/agenix/*` can override declared root ownership through symlinks; source concern, not a verified runtime leak | Verify consumers/runtime ownership, replace blanket ownership with explicit per-file ownership, and recheck target modes | 2026-10-03 | next Darwin activation review | active |
|
||||
| WA-016 | subscription rule snapshots — `modules/nixos/desktop/networking/mihomo/` (`rules_from:`) | mihomo's `proxy-providers` imports proxies only, so the `rules` and `proxy-groups` a subscription ships with are dropped by the core; the generator re-imports them from a local YAML copy that has to be refreshed by hand when the provider changes its routing policy | Drop the snapshots once mihomo can import rules from a proxy-provider, or the providers publish their rules as rule-providers | 2026-10-04 | when mihomo gains rule import | active |
|
||||
| WA-017 | NPU inference for X-ASR — `home/linux/gui/base/vinput/` | OpenVINO and the NPU plugin load and the daemon opens `/dev/accel/accel0`, but no profiling evidence confirms model computation on the NPU; `npu_busy_time_us` did not increase in the sample test | Remove once per-layer NPU profiling confirms execution on `ai` | 2026-10-04 | when model/provider changes | active |
|
||||
|
||||
## WIP
|
||||
|
||||
|
||||
@@ -9,10 +9,7 @@ in
|
||||
./12kingdoms-shoukei/wluma.nix
|
||||
];
|
||||
|
||||
modules.desktop.vinput = {
|
||||
enable = true;
|
||||
backend = "cpu";
|
||||
};
|
||||
modules.desktop.vinput.enable = true;
|
||||
|
||||
programs.ssh.settings."github.com".IdentityFile = "${config.home.homeDirectory}/.ssh/${hostName}";
|
||||
|
||||
|
||||
@@ -10,10 +10,7 @@ in
|
||||
../../linux/gui.nix
|
||||
];
|
||||
|
||||
modules.desktop.vinput = {
|
||||
enable = true;
|
||||
backend = "openvino";
|
||||
};
|
||||
modules.desktop.vinput.enable = true;
|
||||
|
||||
programs.ssh.settings."github.com".IdentityFile = "${config.home.homeDirectory}/.ssh/idols-ai";
|
||||
|
||||
|
||||
@@ -17,20 +17,6 @@ systemctl --user restart vinput-daemon
|
||||
|
||||
`vinput model list -a` lists the available registry models.
|
||||
|
||||
## Backends
|
||||
|
||||
- `shoukei` uses CPU. Leave the model's provider at its default.
|
||||
- `ai` uses OpenVINO when the model's `vinput-model.json` sets `"provider": "openvino"`; restart
|
||||
`vinput-daemon` after changing it. One-shot enable:
|
||||
|
||||
```sh
|
||||
f=~/.local/share/vinput/models/sherpa-onnx/x-asr-960ms-streaming-zipformer-transducer-zh-en-punct-int8/vinput-model.json
|
||||
jq '.model.provider = "openvino"' "$f" | tee "$f.tmp" && mv "$f.tmp" "$f"
|
||||
systemctl --user restart vinput-daemon
|
||||
```
|
||||
|
||||
The user needs the `render` group and a new login after deployment.
|
||||
|
||||
## Persistence
|
||||
|
||||
Models are stored in `~/.local/share/vinput/models/sherpa-onnx/` and the core config lives in
|
||||
@@ -39,17 +25,10 @@ tmpfs-root hosts (see `hosts/idols-ai/preservation.nix`); without that they are
|
||||
reboot and the daemon logs `Local ASR provider model is not configured`. Review model source and
|
||||
license before installing.
|
||||
|
||||
**NPU execution status: unverified.** On `ai`, the OpenVINO runtime and NPU plugin load, the daemon
|
||||
opens `/dev/accel/accel0`, and the bundled WAV sample transcribes. However, the NPU busy-time
|
||||
counter did not increase, and no NPU profiling data has been collected. These observations do not
|
||||
confirm that model computation ran on the NPU; CPU fallback or partial fallback remains possible.
|
||||
|
||||
## Diagnostics
|
||||
|
||||
```sh
|
||||
journalctl --user -b -u vinput-daemon
|
||||
```
|
||||
|
||||
Check the Sherpa/OpenVINO logs for the selected device. A definitive check needs NPU profiling
|
||||
enabled for inference and non-zero per-layer NPU timings; a loaded plugin or device busy-time
|
||||
counter alone is not conclusive.
|
||||
Check the daemon logs for the selected provider, model load, and transcription errors.
|
||||
@@ -3,28 +3,14 @@
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
pkgs-patched,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.modules.desktop.vinput;
|
||||
vinput = import ./package.nix {
|
||||
inherit inputs pkgs pkgs-patched;
|
||||
backend = cfg.backend;
|
||||
};
|
||||
vinput = inputs.fcitx5-vinput.packages.${pkgs.stdenv.hostPlatform.system}.fcitx5-vinput;
|
||||
in
|
||||
{
|
||||
options.modules.desktop.vinput = {
|
||||
enable = lib.mkEnableOption "Fcitx5 Vinput voice input";
|
||||
backend = lib.mkOption {
|
||||
type = lib.types.enum [
|
||||
"cpu"
|
||||
"openvino"
|
||||
];
|
||||
default = "cpu";
|
||||
description = "ASR backend used by Vinput: CPU or OpenVINO.";
|
||||
};
|
||||
};
|
||||
options.modules.desktop.vinput.enable = lib.mkEnableOption "Fcitx5 Vinput voice input";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
i18n.inputMethod.fcitx5.addons = [ vinput ];
|
||||
@@ -47,10 +33,6 @@ in
|
||||
Type = "dbus";
|
||||
BusName = "org.fcitx.Vinput";
|
||||
ExecStart = "${vinput}/bin/vinput-daemon";
|
||||
Environment = lib.optionals (cfg.backend == "openvino") [
|
||||
# OpenVINO dlopens Level Zero and discovers the NPU UMD through these paths.
|
||||
"LD_LIBRARY_PATH=${pkgs.level-zero}/lib:/run/opengl-driver/lib"
|
||||
];
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
};
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
pkgs-patched,
|
||||
backend,
|
||||
}:
|
||||
let
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
sherpaOnnx = inputs.fcitx5-vinput.inputs.sherpa-onnx.packages.${system}.sherpa-onnx;
|
||||
vinput = inputs.fcitx5-vinput.packages.${system}.fcitx5-vinput;
|
||||
in
|
||||
if backend == "openvino" then
|
||||
let
|
||||
sherpaOnnxOpenVino = pkgs-patched.sherpa-onnx;
|
||||
in
|
||||
vinput.overrideAttrs (old: {
|
||||
buildInputs = map (
|
||||
dependency: if dependency == sherpaOnnx then sherpaOnnxOpenVino else dependency
|
||||
) old.buildInputs;
|
||||
passthru = (old.passthru or { }) // {
|
||||
sherpaOnnxVersion = sherpaOnnxOpenVino.version;
|
||||
};
|
||||
})
|
||||
else
|
||||
vinput
|
||||
@@ -1,17 +1,8 @@
|
||||
{
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/hardware/cpu/intel-npu.nix")
|
||||
];
|
||||
|
||||
# Intel NPU support
|
||||
hardware.cpu.intel.npu.enable = true;
|
||||
|
||||
# kvm virtualization support
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{
|
||||
enablesLocalAsr = true;
|
||||
enablesLitePackage = false;
|
||||
sherpaOnnxVersion = "1.13.8";
|
||||
hasVinputDaemon = true;
|
||||
hasOpenvinoServer = false;
|
||||
exposesNpuRuntimeLibraries = true;
|
||||
enablesIntelNpu = true;
|
||||
}
|
||||
@@ -6,21 +6,9 @@ let
|
||||
cfg = outputs.nixosConfigurations.ai-niri.config;
|
||||
hm = cfg.home-manager.users.ryan;
|
||||
packageNames = map (package: package.pname or "") hm.i18n.inputMethod.fcitx5.addons;
|
||||
vinputPackage = builtins.head (
|
||||
builtins.filter (
|
||||
package: (package.pname or "") == "fcitx5-vinput"
|
||||
) hm.i18n.inputMethod.fcitx5.addons
|
||||
);
|
||||
daemonEnvironment = hm.systemd.user.services.vinput-daemon.Service.Environment;
|
||||
in
|
||||
{
|
||||
enablesLocalAsr = builtins.elem "fcitx5-vinput" packageNames;
|
||||
enablesLitePackage = builtins.elem "fcitx5-vinput-lite" packageNames;
|
||||
sherpaOnnxVersion = vinputPackage.passthru.sherpaOnnxVersion or "";
|
||||
hasVinputDaemon = hm.systemd.user.services ? vinput-daemon;
|
||||
hasOpenvinoServer = hm.systemd.user.services ? openvino-npu-stt;
|
||||
exposesNpuRuntimeLibraries = builtins.any (
|
||||
variable: builtins.match "LD_LIBRARY_PATH=.*:/run/opengl-driver/lib" variable != null
|
||||
) daemonEnvironment;
|
||||
enablesIntelNpu = cfg.hardware.cpu.intel.npu.enable;
|
||||
}
|
||||
Reference in new issue
Block a user