From e04155ad5917ba342693360e6f46d10d9e4b7e32 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 28 May 2026 20:36:07 +0000 Subject: [PATCH] opencv: fix on cuda 13.2 --- pkgs/development/libraries/opencv/4.x.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/opencv/4.x.nix b/pkgs/development/libraries/opencv/4.x.nix index 3e81c8a5b008..8898754b7a72 100644 --- a/pkgs/development/libraries/opencv/4.x.nix +++ b/pkgs/development/libraries/opencv/4.x.nix @@ -3,6 +3,7 @@ stdenv, fetchurl, fetchFromGitHub, + fetchpatch, cmake, pkg-config, unzip, @@ -300,9 +301,21 @@ effectiveStdenv.mkDerivation { ./cmake-don-t-use-OpenCVFindOpenEXR.patch ./0001-cmake-OpenCVUtils.cmake-invalidate-Nix-store-paths-b.patch ] - ++ optionals enableCuda [ - ./cuda_opt_flow.patch - ]; + ++ optionals enableCuda ( + [ + ./cuda_opt_flow.patch + ] + ++ optionals (cudaPackages.cudaAtLeast "13.2") [ + # Backport https://github.com/opencv/opencv_contrib/pull/4097 + (fetchpatch { + name = "fix-cuda-13-2-compat"; + url = "https://github.com/opencv/opencv_contrib/commit/f2854f4f5e7b67d4e073ea002ae0174d437e2962.patch"; + stripLen = 2; + extraPrefix = "opencv_contrib/"; + hash = "sha256-nJqPT3gvqTTKFDR9uTFR/7gummlpz1Dw+UQ4EWPfqOA="; + }) + ] + ); postPatch = # This prevents cmake from using libraries in impure paths (which