diff --git a/pkgs/by-name/wh/whisper-cpp/package.nix b/pkgs/by-name/wh/whisper-cpp/package.nix index 25d1f4e3d5f5..d27925dcfc5b 100644 --- a/pkgs/by-name/wh/whisper-cpp/package.nix +++ b/pkgs/by-name/wh/whisper-cpp/package.nix @@ -50,6 +50,13 @@ let optionals ; + inherit (effectiveStdenv.hostPlatform) + isStatic + isLinux + isAarch64 + isx86 + ; + cudaBuildInputs = with cudaPackages; [ cuda_cccl # @@ -125,12 +132,12 @@ effectiveStdenv.mkDerivation (finalAttrs: { (cmakeBool "WHISPER_SDL2" withSDL) (cmakeBool "GGML_LTO" true) (cmakeBool "GGML_NATIVE" false) - (cmakeBool "BUILD_SHARED_LIBS" (!effectiveStdenv.hostPlatform.isStatic)) + (cmakeBool "BUILD_SHARED_LIBS" (!isStatic)) ] - ++ optionals effectiveStdenv.hostPlatform.isLinux [ + ++ optionals isLinux [ (cmakeBool "WHISPER_FFMPEG" withFFmpegSupport) ] - ++ optionals (effectiveStdenv.hostPlatform.isx86 && !effectiveStdenv.hostPlatform.isStatic) [ + ++ optionals (isx86 && !isStatic) [ (cmakeBool "GGML_BACKEND_DL" true) (cmakeBool "GGML_CPU_ALL_VARIANTS" true) (cmakeFeature "GGML_BACKEND_DIR" "${placeholder "out"}/lib") @@ -145,7 +152,7 @@ effectiveStdenv.mkDerivation (finalAttrs: { # Build all targets supported by rocBLAS. When updating search for TARGET_LIST_ROCM # in https://github.com/ROCmSoftwarePlatform/rocBLAS/blob/develop/CMakeLists.txt # and select the line that matches the current nixpkgs version of rocBLAS. - "-DAMDGPU_TARGETS=${rocmGpuTargets}" + (cmakeFeature "AMDGPU_TARGETS" rocmGpuTargets) ] ++ optionals coreMLSupport [ (cmakeBool "WHISPER_COREML" true) @@ -170,7 +177,10 @@ effectiveStdenv.mkDerivation (finalAttrs: { requiredSystemFeatures = optionals rocmSupport [ "big-parallel" ]; # rocmSupport multiplies build time by the number of GPU targets, which takes arround 30 minutes on a 16-cores system to build - doInstallCheck = true; + # libcuda.so is provided by the driver at runtime and is not available in the sandbox + # /nix/store/...-whisper-cpp-1.8.3/bin/whisper-cli: error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory + # NOTE: it is unclear why this isn't an issue on x86_64-linux + doInstallCheck = !(isLinux && isAarch64 && cudaSupport); installCheckPhase = '' runHook preInstallCheck