nix: rm -rf src/xclbins strips git-tracked xclbins (breaks Whisper ASR & VLM vision)
Summary
Both nix/package.nix and nix/open-kernels.nix delete the entire src/xclbins directory before building (rm -rf src/xclbins in nix/package.nix line 127, and rm -rf "$buildTree/src/xclbins" in nix/open-kernels.nix line 65), under the assumption that src/xclbins is completely git-ignored.
However, .gitignore only ignores src/xclbins/BERT-h*/ and src/xclbins/*/open_kernels*/ — 19 directories of prebuilt .xclbin files under src/xclbins/ are tracked in git (including Whisper-V3-Turbo-NPU2/*.xclbin and VLM vision kernels such as Qwen3.5-2B-NPU2/vision_{attn,mm}.xclbin, Gemma3-4B-NPU2, Gemma4-*, GPT-OSS-*, etc.).
Because nix/package.nix deletes src/xclbins in postPatch and symlinks $out/share/oflm/xclbins exclusively to ${openflowlm-open-kernels}/share/oflm/xclbins (which also wiped $buildTree/src/xclbins before running utilities/export-kernels.py), none of the git-tracked .xclbin files end up in the Nix package.
Reproduction
On NixOS using github:Atomic-Germ/OpenFlowLM-Next (tested at 9b1409d):
oflm pull whisper-v3:turbo
oflm pull qwen3.5:2b
oflm serve qwen3.5:2b --asr 1
Output:
[OFLM] ASR mode enabled: reserving additional 1GB of memory
[OFLM] Using environment-specified port: 52625
[OFLM] Loading model: ~/.config/oflm/models/Whisper-V3-Turbo-NPU2
[OFLM] Whisper engine: closed (model.q4nx found, OFLM_WHISPER_ENGINE unset)
[ERROR] Failed to load ASR model: No such file '/nix/store/...-openflowlm-0.1.0/bin/../share/oflm/xclbins/Whisper-V3-Turbo-NPU2/encoder_mm.xclbin'
(Relatedly, utilities/export-kernels.py currently exports dense/MoE specs, BERT sets, and FLUX diffusion sets, so open_kernels/export_whisper_kernels.py is also not invoked during the openflowlm-open-kernels build.)
Suggested Fix
In nix/open-kernels.nix (line 65), instead of removing all of src/xclbins, only remove untracked/generated kernel subdirectories before running export-kernels.py:
rm -rf "$buildTree"/src/xclbins/*/open_kernels* "$buildTree"/src/xclbins/BERT-h*
That way cp -r "$buildTree/src/xclbins" $out/share/oflm/ ships both the exported open_kernels/ sets and the git-tracked .xclbin files in one tree.
Workaround
Merging ${inputs.openflowlm}/src/xclbins back into openflowlm-open-kernels via symlinkJoin in an overlay restores Whisper-V3-Turbo-NPU2/*.xclbin and VLM vision .xclbins and resolves the error.
Those tracked kernels aren't ours! So in the long run, that will not be the solution. In the short term that does work.