anchor.diff:      "-DBUILD_opencv_videoio=OFF"
     ] ++ lib.optionals enablePython [
       "-DOPENCV_SKIP_PYTHON_LOADER=ON"
  +  ] ++ lib.optional enableEigen [
  +    # Autodetection broken by https://github.com/opencv/opencv/pull/13337
  +    "-DEIGEN_INCLUDE_PATH=${eigen}/include/eigen3"
     ];
   
     enableParallelBuilding = true;
  
positive.code:   postUnpack = lib.optionalString buildContrib ''
      cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/opencv_contrib"
    '';
  
    patches = lib.optional stdenv.isDarwin
      (fetchpatch {
        url = "https://github.com/opencv/opencv/commit/7621b91769098359e893e68ad474040ca7940fa1.patch";
        sha256 = "12qb14yd5934ig61lzs4pg29gak9wjyhnj7nmfx5r213jj1a4m21";
      });
  
    # This prevents cmake from using libraries in impure paths (which
    # causes build failure on non NixOS)
  
negative.code: }:
  
  let
    version = "3.4.7";
  
    src = fetchFromGitHub {
      owner  = "opencv";
      repo   = "opencv";
      rev    = version;
      sha256 = "0r5rrcnqx2lsnr1ja5ij2chb7yk9kkamr4p0ik52sqxydwkv3z50";
    };
  
    contribSrc = fetchFromGitHub {
      owner  = "opencv";
      repo   = "opencv_contrib";
      rev    = version;
      sha256 = "1ik6acsmgrx66awf19r2y3ijqvv9xg43gaphwszbiyi0jq3r43yw";
    };
  
    # Contrib must be built in order to enable Tesseract support:
  