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
|
2023-10-09 19:29:22 +00:00
|
|
|
, hatchling
|
2020-04-24 23:36:52 +00:00
|
|
|
, stdenv
|
|
|
|
, xgboost
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage {
|
|
|
|
pname = "xgboost";
|
2023-10-09 19:29:22 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit (xgboost) version src meta;
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
nativeBuildInputs = [ cmake hatchling ];
|
2021-05-20 23:08:51 +00:00
|
|
|
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
|
2023-02-02 18:25:31 +00:00
|
|
|
# (removing sklearn from nativeCheckInputs causes all previously enabled tests to be skipped)
|
2022-12-17 10:02:37 +00:00
|
|
|
# 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
|
|
|
}
|