2021-05-28 09:39:13 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2022-12-17 10:02:37 +00:00
|
|
|
, pythonOlder
|
2021-05-20 23:08:51 +00:00
|
|
|
, cmake
|
2022-12-17 10:02:37 +00:00
|
|
|
, numpy
|
2020-04-24 23:36:52 +00:00
|
|
|
, scipy
|
|
|
|
, stdenv
|
|
|
|
, xgboost
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage {
|
|
|
|
pname = "xgboost";
|
|
|
|
inherit (xgboost) version src meta;
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ xgboost ];
|
2022-12-17 10:02:37 +00:00
|
|
|
propagatedBuildInputs = [ numpy scipy ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# Override existing logic for locating libxgboost.so which is not appropriate for Nix
|
|
|
|
prePatch = let
|
|
|
|
libPath = "${xgboost}/lib/libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
in ''
|
|
|
|
echo 'find_lib_path = lambda: ["${libPath}"]' > python-package/xgboost/libpath.py
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
dontUseCmakeConfigure = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postPatch = ''
|
|
|
|
cd python-package
|
|
|
|
'';
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
# test setup tries to download test data with no option to disable
|
|
|
|
# (removing sklearn from checkInputs causes all previously enabled tests to be skipped)
|
|
|
|
# and are extremely cpu intensive anyway
|
|
|
|
doCheck = false;
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"xgboost"
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|