diff --git a/pkgs/tools/audio/openai-whisper-cpp/default.nix b/pkgs/tools/audio/openai-whisper-cpp/default.nix index eac34e30b08c..53e609d9d07a 100644 --- a/pkgs/tools/audio/openai-whisper-cpp/default.nix +++ b/pkgs/tools/audio/openai-whisper-cpp/default.nix @@ -8,6 +8,7 @@ , CoreGraphics , CoreML , CoreVideo +, MetalKit }: stdenv.mkDerivation rec { @@ -29,7 +30,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ SDL2 ] ++ lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreML CoreVideo ]; + buildInputs = [ SDL2 ] ++ lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreML CoreVideo MetalKit ]; env = lib.optionalAttrs stdenv.isDarwin { WHISPER_COREML = "1"; @@ -51,6 +52,15 @@ stdenv.mkDerivation rec { wrapProgram $out/bin/whisper-cpp-download-ggml-model \ --prefix PATH : ${lib.makeBinPath [wget]} + ${lib.optionalString stdenv.isDarwin '' + install -Dt $out/share/whisper-cpp ggml-metal.metal + + for bin in whisper-cpp whisper-cpp-stream whisper-cpp-command; do + wrapProgram $out/bin/$bin \ + --set-default GGML_METAL_PATH_RESOURCES $out/share/whisper-cpp + done + ''} + runHook postInstall ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 419ebf4580dd..d3e5418fa359 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19716,7 +19716,7 @@ with pkgs; openai-whisper = with python3.pkgs; toPythonApplication openai-whisper; openai-whisper-cpp = darwin.apple_sdk_11_0.callPackage ../tools/audio/openai-whisper-cpp { - inherit (darwin.apple_sdk_11_0.frameworks) Accelerate CoreGraphics CoreML CoreVideo; + inherit (darwin.apple_sdk_11_0.frameworks) Accelerate CoreGraphics CoreML CoreVideo MetalKit; }; opengrok = callPackage ../development/tools/misc/opengrok { };