A J Greengrove

As documented in SYSTRAN/faster-whisper #717, upgrading faster-whisper can trigger runtime crashes like libcublas.so.12 is not found or cannot be loaded. This forces developers to imperatively hack: manually appending .venv site-packages to LD_LIBRARY_PATH or pulling heavy CUDA base images. However, solving this declaratively in Nix often leads to a second trap: turning on global CUDA support flags that bypass pre-built binary caches and trigger multi-gigabyte source builds. By using Nix strictly at build-time to emit a layered OCI container, we resolve the dynamic linking crash declaratively—producing a standard Docker image that runs on any NVIDIA-equipped host without requiring Nix at runtime.

Executive Telemetry & Verification Proofs

Local Runner (act linux/amd64)

Remote GitHub Actions (ubuntu-latest)

Symptoms, Root Causes and Remediations

Implementation Artifacts

pkgs = import nixpkgs {
  inherit system;
  config = {
    allowUnfree = true;
-   cudaSupport = true;
  };
};
- pythonPackages = pkgs.python311Packages;
+ pythonPackages = pkgs.python3Packages;
runtimeLibs = [
  pkgs.stdenv.cc.cc.lib
  pkgs.glibc
  pkgs.zlib
  pkgs.ffmpeg-headless
  pkgs.libsndfile
+ pkgs.cudaPackages.cudatoolkit
+ pkgs.cudaPackages.cudnn
+ pkgs.cudaPackages.libcublas
+ pkgs.cudaPackages.libcufft
+ pkgs.cudaPackages.libcurand
];

Platform Rules of Engagement

Local Reproduction Sequence

# Ensure .gitignore does not untrack flake.nix, source code, or required assets
git add -N .
nix flake check
nix eval .#dockerImage.drvPath
nix develop --command python3 -c "import faster_whisper; print('Import OK:', faster_whisper.__file__)"
nix build .#dockerImage --dry-run
nix build .#dockerImage
docker load < result
docker run --rm faster-whisper:latest
act -j build-and-validate --container-architecture linux/amd64
gh repo set-default ajgreengrove/faster-whisper-ci-poc
gh run watch 35461703995

Reproduction & Performance Benchmark

The libcublas.so.12 failure in #717 stems from dynamic linking mismatch across runtime environments. While manual shell exports or heavy base images temporarily bypass the crash, they break environment reproducibility. Decoupling user-space CUDA runtime libraries from top-level Nix compiler flags fixes the library path cleanly—packaging the environment into a lightweight Docker image that stays fast, deterministic, and cache-friendly.