at master 19 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchFromGitHub, 6 cmake, 7 pkg-config, 8 unzip, 9 zlib, 10 pcre2, 11 hdf5, 12 boost, 13 glib, 14 glog, 15 gflags, 16 protobuf, 17 config, 18 ocl-icd, 19 qimgv, 20 opencv4, 21 22 enableJPEG ? true, 23 libjpeg, 24 enablePNG ? true, 25 libpng, 26 enableTIFF ? true, 27 libtiff, 28 enableWebP ? true, 29 libwebp, 30 enableEXR ? !stdenv.hostPlatform.isDarwin, 31 openexr, 32 enableJPEG2000 ? true, 33 openjpeg, 34 enableEigen ? true, 35 eigen, 36 enableBlas ? true, 37 blas, 38 enableVA ? !stdenv.hostPlatform.isDarwin, 39 libva, 40 enableContrib ? true, 41 42 enableCuda ? config.cudaSupport, 43 enableCublas ? enableCuda, 44 enableCudnn ? false, # NOTE: CUDNN has a large impact on closure size so we disable it by default 45 enableCufft ? enableCuda, 46 cudaPackages, 47 nvidia-optical-flow-sdk, 48 49 enableLto ? true, 50 enableUnfree ? false, 51 enableIpp ? false, 52 enablePython ? false, 53 pythonPackages, 54 enableGtk2 ? false, 55 gtk2, 56 enableGtk3 ? false, 57 gtk3, 58 enableVtk ? false, 59 vtk, 60 enableFfmpeg ? true, 61 ffmpeg, 62 enableGStreamer ? true, 63 elfutils, 64 gst_all_1, 65 orc, 66 libunwind, 67 zstd, 68 enableTesseract ? false, 69 tesseract, 70 leptonica, 71 enableTbb ? false, 72 tbb, 73 enableOvis ? false, 74 ogre, 75 enableGPhoto2 ? false, 76 libgphoto2, 77 enableDC1394 ? false, 78 libdc1394, 79 enableDocs ? false, 80 doxygen, 81 graphviz-nox, 82 83 runAccuracyTests ? true, 84 runPerformanceTests ? false, 85 # Modules to enable via BUILD_LIST to build a customized opencv. 86 # An empty lists means this setting is omitted which matches upstreams default. 87 enabledModules ? [ ], 88 89 bzip2, 90 callPackage, 91}@inputs: 92 93let 94 inherit (lib.attrsets) mapAttrsToList optionalAttrs; 95 inherit (lib.lists) last optionals; 96 inherit (lib.strings) 97 cmakeBool 98 cmakeFeature 99 cmakeOptionType 100 concatStrings 101 concatStringsSep 102 optionalString 103 ; 104 inherit (lib.trivial) flip; 105 106 version = "4.12.0"; 107 108 # It's necessary to consistently use backendStdenv when building with CUDA 109 # support, otherwise we get libstdc++ errors downstream 110 stdenv = throw "Use effectiveStdenv instead"; 111 effectiveStdenv = if enableCuda then cudaPackages.backendStdenv else inputs.stdenv; 112 113 src = fetchFromGitHub { 114 owner = "opencv"; 115 repo = "opencv"; 116 tag = version; 117 hash = "sha256-TZdEeZyBY3vCI53g4VDMzl3AASMuXAZKrSH/+XlxR7c="; 118 }; 119 120 contribSrc = fetchFromGitHub { 121 owner = "opencv"; 122 repo = "opencv_contrib"; 123 tag = version; 124 hash = "sha256-YNd96qFJ8SHBgDEEsoNps888myGZdELbbuYCae9pW3M="; 125 }; 126 127 testDataSrc = fetchFromGitHub { 128 owner = "opencv"; 129 repo = "opencv_extra"; 130 tag = version; 131 hash = "sha256-EqlGlemztYlk03MX1LAviArWT+OA3/qL3jfgHYC+SP8="; 132 }; 133 134 # Contrib must be built in order to enable Tesseract support: 135 buildContrib = enableContrib || enableTesseract || enableOvis; 136 137 # See opencv/3rdparty/ippicv/ippicv.cmake 138 ippicv = { 139 src = 140 fetchFromGitHub { 141 owner = "opencv"; 142 repo = "opencv_3rdparty"; 143 rev = "7f55c0c26be418d494615afca15218566775c725"; 144 hash = "sha256-XbmS+FXUL8MAG7kawbDkb2XHG9R0DpPhiYhq/18eTnY="; 145 } 146 + "/ippicv"; 147 files = 148 let 149 name = platform: "ippicv_2021.10.0_${platform}_20230919_general.tgz"; 150 in 151 if effectiveStdenv.hostPlatform.system == "x86_64-linux" then 152 { ${name "lnx_intel64"} = ""; } 153 else if effectiveStdenv.hostPlatform.system == "i686-linux" then 154 { ${name "lnx_ia32"} = ""; } 155 else if effectiveStdenv.hostPlatform.system == "x86_64-darwin" then 156 { ${name "mac_intel64"} = ""; } 157 else 158 throw "ICV is not available for this platform (or not yet supported by this package)"; 159 dst = ".cache/ippicv"; 160 }; 161 162 # See opencv_contrib/modules/xfeatures2d/cmake/download_vgg.cmake 163 vgg = { 164 src = fetchFromGitHub { 165 owner = "opencv"; 166 repo = "opencv_3rdparty"; 167 rev = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"; 168 hash = "sha256-fjdGM+CxV1QX7zmF2AiR9NDknrP2PjyaxtjT21BVLmU="; 169 }; 170 files = { 171 "vgg_generated_48.i" = "e8d0dcd54d1bcfdc29203d011a797179"; 172 "vgg_generated_64.i" = "7126a5d9a8884ebca5aea5d63d677225"; 173 "vgg_generated_80.i" = "7cd47228edec52b6d82f46511af325c5"; 174 "vgg_generated_120.i" = "151805e03568c9f490a5e3a872777b75"; 175 }; 176 dst = ".cache/xfeatures2d/vgg"; 177 }; 178 179 # See opencv_contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake 180 boostdesc = { 181 src = fetchFromGitHub { 182 owner = "opencv"; 183 repo = "opencv_3rdparty"; 184 rev = "34e4206aef44d50e6bbcd0ab06354b52e7466d26"; 185 sha256 = "13yig1xhvgghvxspxmdidss5lqiikpjr0ddm83jsi0k85j92sn62"; 186 }; 187 files = { 188 "boostdesc_bgm.i" = "0ea90e7a8f3f7876d450e4149c97c74f"; 189 "boostdesc_bgm_bi.i" = "232c966b13651bd0e46a1497b0852191"; 190 "boostdesc_bgm_hd.i" = "324426a24fa56ad9c5b8e3e0b3e5303e"; 191 "boostdesc_binboost_064.i" = "202e1b3e9fec871b04da31f7f016679f"; 192 "boostdesc_binboost_128.i" = "98ea99d399965c03d555cef3ea502a0b"; 193 "boostdesc_binboost_256.i" = "e6dcfa9f647779eb1ce446a8d759b6ea"; 194 "boostdesc_lbgm.i" = "0ae0675534aa318d9668f2a179c2a052"; 195 }; 196 dst = ".cache/xfeatures2d/boostdesc"; 197 }; 198 199 # See opencv_contrib/modules/face/CMakeLists.txt 200 face = { 201 src = fetchFromGitHub { 202 owner = "opencv"; 203 repo = "opencv_3rdparty"; 204 rev = "8afa57abc8229d611c4937165d20e2a2d9fc5a12"; 205 hash = "sha256-m9yF4kfmpRJybohdRwUTmboeU+SbZQ6F6gm32PDWNBg="; 206 }; 207 files = { 208 "face_landmark_model.dat" = "7505c44ca4eb54b4ab1e4777cb96ac05"; 209 }; 210 dst = ".cache/data"; 211 }; 212 213 # See opencv/modules/gapi/cmake/DownloadADE.cmake 214 ade = rec { 215 src = fetchurl { 216 url = "https://github.com/opencv/ade/archive/${name}"; 217 hash = "sha256-O+Yshk3N2Lkl6S9qWxWnoDmBngSms88IiCfwjPLMB78="; 218 }; 219 name = "v0.1.2e.zip"; 220 md5 = "962ce79e0b95591f226431f7b5f152cd"; 221 dst = ".cache/ade"; 222 }; 223 224 # See opencv_contrib/modules/wechat_qrcode/CMakeLists.txt 225 wechat_qrcode = { 226 src = fetchFromGitHub { 227 owner = "opencv"; 228 repo = "opencv_3rdparty"; 229 rev = "a8b69ccc738421293254aec5ddb38bd523503252"; 230 hash = "sha256-/n6zHwf0Rdc4v9o4rmETzow/HTv+81DnHP+nL56XiTY="; 231 }; 232 files = { 233 "detect.caffemodel" = "238e2b2d6f3c18d6c3a30de0c31e23cf"; 234 "detect.prototxt" = "6fb4976b32695f9f5c6305c19f12537d"; 235 "sr.caffemodel" = "cbfcd60361a73beb8c583eea7e8e6664"; 236 "sr.prototxt" = "69db99927a70df953b471daaba03fbef"; 237 }; 238 dst = ".cache/wechat_qrcode"; 239 }; 240 241 # See opencv/cmake/OpenCVDownload.cmake 242 installExtraFiles = 243 { 244 dst, 245 files, 246 src, 247 ... 248 }: 249 '' 250 mkdir -p "${dst}" 251 '' 252 + concatStrings ( 253 flip mapAttrsToList files ( 254 name: md5: '' 255 ln -s "${src}/${name}" "${dst}/${md5}-${name}" 256 '' 257 ) 258 ); 259 installExtraFile = 260 { 261 dst, 262 md5, 263 name, 264 src, 265 ... 266 }: 267 '' 268 mkdir -p "${dst}" 269 ln -s "${src}" "${dst}/${md5}-${name}" 270 ''; 271 272 withOpenblas = (enableBlas && blas.provider.pname == "openblas"); 273 #multithreaded openblas conflicts with opencv multithreading, which manifest itself in hung tests 274 #https://github.com/OpenMathLib/OpenBLAS/wiki/Faq/4bded95e8dc8aadc70ce65267d1093ca7bdefc4c#multi-threaded 275 openblas_ = blas.provider.override { singleThreaded = true; }; 276 277 inherit (cudaPackages.flags) cmakeCudaArchitecturesString cudaCapabilities; 278 279in 280 281effectiveStdenv.mkDerivation { 282 pname = "opencv"; 283 inherit version src; 284 285 outputs = [ 286 "out" 287 "cxxdev" 288 ] 289 ++ optionals (runAccuracyTests || runPerformanceTests) [ 290 "package_tests" 291 ]; 292 cudaPropagateToOutput = "cxxdev"; 293 294 postUnpack = optionalString buildContrib '' 295 cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/source/opencv_contrib" 296 ''; 297 298 # Ensures that we use the system OpenEXR rather than the vendored copy of the source included with OpenCV. 299 patches = [ 300 ./cmake-don-t-use-OpenCVFindOpenEXR.patch 301 ] 302 ++ optionals enableCuda [ 303 ./cuda_opt_flow.patch 304 ]; 305 306 # This prevents cmake from using libraries in impure paths (which 307 # causes build failure on non NixOS) 308 postPatch = '' 309 sed -i '/Add these standard paths to the search paths for FIND_LIBRARY/,/^\s*$/{d}' CMakeLists.txt 310 ''; 311 312 preConfigure = 313 installExtraFile ade 314 + optionalString enableIpp (installExtraFiles ippicv) 315 + (optionalString buildContrib '' 316 cmakeFlagsArray+=("-DOPENCV_EXTRA_MODULES_PATH=$NIX_BUILD_TOP/source/opencv_contrib") 317 318 ${installExtraFiles vgg} 319 ${installExtraFiles boostdesc} 320 ${installExtraFiles face} 321 ${installExtraFiles wechat_qrcode} 322 ''); 323 324 postConfigure = '' 325 [ -e modules/core/version_string.inc ] 326 echo '"(build info elided)"' > modules/core/version_string.inc 327 ''; 328 329 buildInputs = [ 330 boost 331 gflags 332 glib 333 glog 334 pcre2 335 protobuf 336 zlib 337 ] 338 ++ optionals enablePython [ 339 pythonPackages.python 340 ] 341 ++ optionals (effectiveStdenv.buildPlatform == effectiveStdenv.hostPlatform) [ 342 hdf5 343 ] 344 ++ optionals enableGtk2 [ 345 gtk2 346 ] 347 ++ optionals enableGtk3 [ 348 gtk3 349 ] 350 ++ optionals enableVtk [ 351 vtk 352 ] 353 ++ optionals enableJPEG [ 354 libjpeg 355 ] 356 ++ optionals enablePNG [ 357 libpng 358 ] 359 ++ optionals enableTIFF [ 360 libtiff 361 ] 362 ++ optionals enableWebP [ 363 libwebp 364 ] 365 ++ optionals enableEXR [ 366 openexr 367 ] 368 ++ optionals enableJPEG2000 [ 369 openjpeg 370 ] 371 ++ optionals enableFfmpeg [ 372 ffmpeg 373 ] 374 ++ optionals (enableGStreamer && effectiveStdenv.hostPlatform.isLinux) [ 375 elfutils 376 gst_all_1.gst-plugins-base 377 gst_all_1.gst-plugins-good 378 gst_all_1.gstreamer 379 libunwind 380 orc 381 zstd 382 ] 383 ++ optionals enableOvis [ 384 ogre 385 ] 386 ++ optionals enableGPhoto2 [ 387 libgphoto2 388 ] 389 ++ optionals enableDC1394 [ 390 libdc1394 391 ] 392 ++ optionals enableEigen [ 393 eigen 394 ] 395 ++ optionals enableVA [ 396 libva 397 ] 398 ++ optionals enableBlas [ 399 blas.provider 400 ] 401 ++ optionals enableTesseract [ 402 # There is seemingly no compile-time flag for Tesseract. It's 403 # simply enabled automatically if contrib is built, and it detects 404 # tesseract & leptonica. 405 tesseract 406 leptonica 407 ] 408 ++ optionals enableTbb [ 409 tbb 410 ] 411 ++ optionals effectiveStdenv.hostPlatform.isDarwin [ 412 bzip2 413 ] 414 ++ optionals enableDocs [ 415 doxygen 416 graphviz-nox 417 ] 418 ++ optionals enableCuda [ 419 cudaPackages.cuda_cudart 420 cudaPackages.cuda_cccl # <thrust/*> 421 cudaPackages.libnpp # npp.h 422 nvidia-optical-flow-sdk 423 ] 424 ++ optionals enableCublas [ 425 # May start using the default $out instead once 426 # https://github.com/NixOS/nixpkgs/issues/271792 427 # has been addressed 428 cudaPackages.libcublas # cublas_v2.h 429 ] 430 ++ optionals enableCudnn [ 431 cudaPackages.cudnn # cudnn.h 432 ] 433 ++ optionals enableCufft [ 434 cudaPackages.libcufft # cufft.h 435 ]; 436 437 propagatedBuildInputs = optionals enablePython [ pythonPackages.numpy ]; 438 439 nativeBuildInputs = [ 440 cmake 441 pkg-config 442 unzip 443 ] 444 ++ optionals enablePython ( 445 [ 446 pythonPackages.pip 447 pythonPackages.wheel 448 pythonPackages.setuptools 449 ] 450 ++ optionals (effectiveStdenv.hostPlatform == effectiveStdenv.buildPlatform) [ 451 pythonPackages.pythonImportsCheckHook 452 ] 453 ) 454 ++ optionals enableCuda [ 455 cudaPackages.cuda_nvcc 456 ]; 457 458 # Configure can't find the library without this. 459 OpenBLAS_HOME = optionalString withOpenblas openblas_.dev; 460 OpenBLAS = optionalString withOpenblas openblas_; 461 462 cmakeFlags = [ 463 (cmakeBool "OPENCV_GENERATE_PKGCONFIG" true) 464 (cmakeBool "WITH_OPENMP" true) 465 (cmakeBool "BUILD_PROTOBUF" false) 466 (cmakeFeature "CMAKE_CXX_STANDARD" "17") # required to enable protobuf 467 (cmakeBool "WITH_PROTOBUF" true) 468 (cmakeBool "PROTOBUF_UPDATE_FILES" true) 469 (cmakeBool "OPENCV_ENABLE_NONFREE" enableUnfree) 470 (cmakeBool "BUILD_TESTS" runAccuracyTests) 471 (cmakeBool "BUILD_PERF_TESTS" runPerformanceTests) 472 (cmakeBool "CMAKE_SKIP_BUILD_RPATH" true) 473 (cmakeBool "BUILD_DOCS" enableDocs) 474 # "OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT" 475 # but we have proper separation of build and host libs :), fixes cross 476 (cmakeBool "OPENCV_ENABLE_PKG_CONFIG" true) 477 (cmakeBool "WITH_IPP" enableIpp) 478 (cmakeBool "WITH_TIFF" enableTIFF) 479 (cmakeBool "WITH_WEBP" enableWebP) 480 (cmakeBool "WITH_JPEG" enableJPEG) 481 (cmakeBool "WITH_PNG" enablePNG) 482 (cmakeBool "WITH_OPENEXR" enableEXR) 483 (cmakeBool "WITH_OPENJPEG" enableJPEG2000) 484 (cmakeBool "WITH_JASPER" false) # OpenCV falls back to a vendored copy of Jasper when OpenJPEG is disabled 485 (cmakeBool "WITH_TBB" enableTbb) 486 487 # CUDA options 488 (cmakeBool "WITH_CUDA" enableCuda) 489 (cmakeBool "WITH_CUBLAS" enableCublas) 490 (cmakeBool "WITH_CUDNN" enableCudnn) 491 (cmakeBool "WITH_CUFFT" enableCufft) 492 493 # LTO options 494 (cmakeBool "ENABLE_LTO" enableLto) 495 (cmakeBool "ENABLE_THIN_LTO" ( 496 enableLto 497 && ( 498 # Only clang supports thin LTO, so we must either be using clang through the effectiveStdenv, 499 effectiveStdenv.cc.isClang 500 || 501 # or through the backend effectiveStdenv. 502 (enableCuda && effectiveStdenv.cc.isClang) 503 ) 504 )) 505 ] 506 ++ optionals enableCuda [ 507 (cmakeBool "CUDA_FAST_MATH" true) 508 (cmakeFeature "CUDA_NVCC_FLAGS" "--expt-relaxed-constexpr") 509 510 # OpenCV respects at least three variables: 511 # -DCUDA_GENERATION takes a single arch name, e.g. Volta 512 # -DCUDA_ARCH_BIN takes a semi-colon separated list of real arches, e.g. "8.0;8.6" 513 # -DCUDA_ARCH_PTX takes the virtual arch, e.g. "8.6" 514 (cmakeFeature "CUDA_ARCH_BIN" cmakeCudaArchitecturesString) 515 (cmakeFeature "CUDA_ARCH_PTX" (last cudaCapabilities)) 516 517 (cmakeOptionType "path" "NVIDIA_OPTICAL_FLOW_2_0_HEADERS_PATH" nvidia-optical-flow-sdk.outPath) 518 ] 519 ++ optionals effectiveStdenv.hostPlatform.isDarwin [ 520 (cmakeBool "WITH_OPENCL" false) 521 (cmakeBool "WITH_LAPACK" false) 522 523 # Disable unnecessary vendoring that's enabled by default only for Darwin. 524 # Note that the opencvFlag feature flags listed above still take 525 # precedence, so we can safely list everything here. 526 (cmakeBool "BUILD_ZLIB" false) 527 (cmakeBool "BUILD_TIFF" false) 528 (cmakeBool "BUILD_OPENJPEG" false) 529 (cmakeBool "BUILD_JASPER" false) 530 (cmakeBool "BUILD_JPEG" false) 531 (cmakeBool "BUILD_PNG" false) 532 (cmakeBool "BUILD_WEBP" false) 533 ] 534 ++ optionals (!effectiveStdenv.hostPlatform.isDarwin) [ 535 (cmakeOptionType "path" "OPENCL_LIBRARY" "${ocl-icd}/lib/libOpenCL.so") 536 ] 537 ++ optionals enablePython [ 538 (cmakeOptionType "path" "OPENCV_PYTHON_INSTALL_PATH" pythonPackages.python.sitePackages) 539 ] 540 ++ optionals (enabledModules != [ ]) [ 541 (cmakeFeature "BUILD_LIST" (concatStringsSep "," enabledModules)) 542 ]; 543 544 postBuild = optionalString enableDocs '' 545 make doxygen 546 ''; 547 548 preInstall = 549 optionalString (runAccuracyTests || runPerformanceTests) '' 550 mkdir $package_tests 551 cp -R $src/samples $package_tests/ 552 '' 553 + optionalString runAccuracyTests '' 554 mv ./bin/*test* $package_tests/ 555 '' 556 + optionalString runPerformanceTests '' 557 mv ./bin/*perf* $package_tests/ 558 ''; 559 560 # By default $out/lib/pkgconfig/opencv4.pc looks something like this: 561 # 562 # prefix=/nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0 563 # exec_prefix=${prefix} 564 # libdir=${exec_prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/lib 565 # includedir_old=${prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/include/opencv4/opencv 566 # includedir_new=${prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/include/opencv4 567 # ... 568 # Libs: -L${exec_prefix}//nix/store/g0wnfyjjh4rikkvp22cpkh41naa43i4i-opencv-4.0.0/lib ... 569 # Note that ${exec_prefix} is set to $out but that $out is also appended to 570 # ${exec_prefix}. This causes linker errors in downstream packages so we strip 571 # of $out after the ${exec_prefix} and ${prefix} prefixes: 572 postInstall = '' 573 sed -i "s|{exec_prefix}/$out|{exec_prefix}|;s|{prefix}/$out|{prefix}|" \ 574 "$out/lib/pkgconfig/opencv4.pc" 575 mkdir "$cxxdev" 576 '' 577 # fix deps not propagating from opencv4.cxxdev if cuda is disabled 578 # see https://github.com/NixOS/nixpkgs/issues/276691 579 + optionalString (!enableCuda) '' 580 mkdir -p "$cxxdev/nix-support" 581 echo "''${!outputDev}" >> "$cxxdev/nix-support/propagated-build-inputs" 582 '' 583 # remove the requirement that the exact same version of CUDA is used in packages 584 # consuming OpenCV's CMakes files 585 + optionalString enableCuda '' 586 substituteInPlace "$out/lib/cmake/opencv4/OpenCVConfig.cmake" \ 587 --replace-fail \ 588 'find_host_package(CUDA ''${OpenCV_CUDA_VERSION} EXACT REQUIRED)' \ 589 'find_host_package(CUDAToolkit REQUIRED)' \ 590 --replace-fail \ 591 'message(FATAL_ERROR "OpenCV static library was compiled with CUDA' \ 592 'message("OpenCV static library was compiled with CUDA' 593 '' 594 # install python distribution information, so other packages can `import opencv` 595 + optionalString enablePython '' 596 pushd $NIX_BUILD_TOP/$sourceRoot/modules/python/package 597 python -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist . 598 599 pushd dist 600 python -m pip install ./*.whl --no-index --no-warn-script-location --prefix="$out" --no-cache 601 602 popd 603 popd 604 ''; 605 606 pythonImportsCheck = [ 607 "cv2" 608 "cv2.sfm" 609 ]; 610 611 passthru = { 612 cudaSupport = enableCuda; 613 614 tests = { 615 inherit (gst_all_1) gst-plugins-bad; 616 } 617 // optionalAttrs (!effectiveStdenv.hostPlatform.isDarwin) { 618 inherit qimgv; 619 withIpp = opencv4.override { enableIpp = true; }; 620 } 621 // optionalAttrs (!enablePython) { pythonEnabled = pythonPackages.opencv4; } 622 // optionalAttrs (effectiveStdenv.buildPlatform != "x86_64-darwin") { 623 opencv4-tests = callPackage ./tests.nix { 624 inherit 625 enableGStreamer 626 enableGtk2 627 enableGtk3 628 runAccuracyTests 629 runPerformanceTests 630 testDataSrc 631 ; 632 inherit opencv4; 633 }; 634 } 635 // optionalAttrs (enableCuda) { 636 no-libstdcxx-errors = callPackage ./libstdcxx-test.nix { attrName = "opencv4"; }; 637 }; 638 } 639 // optionalAttrs enablePython { pythonPath = [ ]; }; 640 641 meta = { 642 description = "Open Computer Vision Library with more than 500 algorithms"; 643 homepage = "https://opencv.org/"; 644 license = if enableUnfree then lib.licenses.unfree else lib.licenses.bsd3; 645 maintainers = with lib.maintainers; [ basvandijk ]; 646 platforms = lib.platforms.unix; 647 }; 648}