15 cudaSupport ? config.cudaSupport,
18 pythonSupport ? false,
21 inherit (llvmPackages) stdenv;
24 stdenv.mkDerivation (finalAttrs: {
28 src = fetchFromGitHub {
31 rev = "refs/tags/v${finalAttrs.version}";
32 hash = "sha256-I3geFdVQ1Pm61eRXi+ueaxel3QRb8EJV9f4zV2Q7kk4=";
40 substituteInPlace cmake/common.cmake \
41 --replace-fail "\''${RAGEL_BIN}" "${ragel}/bin/ragel" \
42 --replace-fail "\''${YASM_BIN}" "${yasm}/bin/yasm"
45 for cmakelists in **/CMakeLists.*; do
46 sed -i "s/OpenSSL::OpenSSL/OpenSSL::SSL/g" $cmakelists
47 ${lib.optionalString (lib.versionOlder cudaPackages.cudaVersion "11.8") ''
48 sed -i 's/-gencode=arch=compute_89,code=sm_89//g' $cmakelists
49 sed -i 's/-gencode=arch=compute_90,code=sm_90//g' $cmakelists
64 (python3Packages.python.withPackages (ps: with ps; [ six ]))
68 ++ lib.optionals stdenv.hostPlatform.isDarwin [
71 ++ lib.optionals cudaSupport (
83 ++ lib.optionals stdenv.hostPlatform.isDarwin [
86 ++ lib.optionals cudaSupport (
96 PROGRAM_VERSION = finalAttrs.version;
98 # catboost requires clang 14+ for build, but does clang 12 for cuda build.
99 # after bumping the default version of llvm, check for compatibility with the cuda backend and pin it.
100 # see https://catboost.ai/en/docs/installation/build-environment-setup-for-cmake#compilers,-linkers-and-related-tools
101 CUDAHOSTCXX = lib.optionalString cudaSupport "${llvmPackages_12.stdenv.cc}/bin/cc";
102 NIX_CFLAGS_LINK = lib.optionalString stdenv.hostPlatform.isLinux "-fuse-ld=lld";
103 NIX_LDFLAGS = "-lc -lm";
107 (lib.cmakeFeature "CMAKE_BINARY_DIR" "$out")
108 (lib.cmakeBool "CMAKE_POSITION_INDEPENDENT_CODE" true)
109 (lib.cmakeFeature "CATBOOST_COMPONENTS" "app;libs${lib.optionalString pythonSupport ";python-package"}")
110 (lib.cmakeBool "HAVE_CUDA" cudaSupport)
118 install -Dm555 catboost/app/catboost -t $out/bin
119 install -Dm444 catboost/libs/model_interface/static/lib/libmodel_interface-static-lib.a -t $out/lib
120 install -Dm444 catboost/libs/model_interface/libcatboostmodel${stdenv.hostPlatform.extensions.sharedLibrary} -t $out/lib
121 install -Dm444 catboost/libs/train_interface/libcatboost${stdenv.hostPlatform.extensions.sharedLibrary} -t $out/lib
127 description = "High-performance library for gradient boosting on decision trees";
129 A fast, scalable, high performance Gradient Boosting on Decision Trees
130 library, used for ranking, classification, regression and other machine
131 learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.
133 changelog = "https://github.com/catboost/catboost/releases/tag/v${finalAttrs.version}";
134 license = licenses.asl20;
135 platforms = platforms.unix;
136 homepage = "https://catboost.ai";
137 maintainers = with maintainers; [
141 mainProgram = "catboost";
142 # /nix/store/hzxiynjmmj35fpy3jla7vcqwmzj9i449-Libsystem-1238.60.2/include/sys/_types/_mbstate_t.h:31:9: error: unknown type name '__darwin_mbstate_t'
143 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64;