diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/xgboost')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/xgboost/default.nix | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/xgboost/default.nix b/nixpkgs/pkgs/development/libraries/xgboost/default.nix new file mode 100644 index 000000000000..d9e204506239 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/xgboost/default.nix @@ -0,0 +1,58 @@ +{ config +, stdenv +, lib +, fetchFromGitHub +, cmake +, gtest +, doCheck ? true +, cudaSupport ? config.cudaSupport or false +, cudatoolkit +, ncclSupport ? false +, nccl +, llvmPackages +}: + +assert ncclSupport -> cudaSupport; + +stdenv.mkDerivation rec { + pname = "xgboost"; + version = "1.5.0"; + + src = fetchFromGitHub { + owner = "dmlc"; + repo = pname; + rev = "v${version}"; + fetchSubmodules = true; + sha256 = "sha256-xrRKpZ6NSBtEL2CBN7KggDwIvQKIPD8EBlA0oCJv8mw="; + }; + + nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp; + + buildInputs = [ gtest ] ++ lib.optional cudaSupport cudatoolkit + ++ lib.optional ncclSupport nccl; + + cmakeFlags = lib.optionals doCheck [ "-DGOOGLE_TEST=ON" ] + ++ lib.optionals cudaSupport [ "-DUSE_CUDA=ON" "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc" ] + ++ lib.optionals ncclSupport [ "-DUSE_NCCL=ON" ]; + + inherit doCheck; + + installPhase = let + libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}"; + in '' + runHook preInstall + mkdir -p $out + cp -r ../include $out + install -Dm755 ../lib/${libname} $out/lib/${libname} + install -Dm755 ../xgboost $out/bin/xgboost + runHook postInstall + ''; + + meta = with lib; { + description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library"; + homepage = "https://github.com/dmlc/xgboost"; + license = licenses.asl20; + platforms = platforms.unix; + maintainers = with maintainers; [ abbradar ]; + }; +} |