From d411ab855c565d0d166edf177b558bddcc3d7cd9 Mon Sep 17 00:00:00 2001 From: Ethan Carter Edwards Date: Mon, 7 Sep 2026 21:39:06 -0400 Subject: [PATCH] xgboost: finalAttrs, enable __structuredAttrs, strictDeps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: GaƩtan Lepage Signed-off-by: Ethan Carter Edwards --- pkgs/by-name/xg/xgboost/package.nix | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/xg/xgboost/package.nix b/pkgs/by-name/xg/xgboost/package.nix index 31025120a5c9..56af179d9123 100644 --- a/pkgs/by-name/xg/xgboost/package.nix +++ b/pkgs/by-name/xg/xgboost/package.nix @@ -33,7 +33,7 @@ let stdenv = throw "Use effectiveStdenv instead of stdenv in xgboost derivation."; in -effectiveStdenv.mkDerivation rec { +effectiveStdenv.mkDerivation (finalAttrs: { pnameBase = "xgboost"; # prefix with r when building the R library # The R package build results in a special xgboost.so file @@ -50,10 +50,14 @@ effectiveStdenv.mkDerivation rec { pname = lib.optionalString rLibrary "r-" + "xgboost"; version = "3.0.5"; + strictDeps = true; + __structuredAttrs = true; + __darwinAllowLocalNetworking = true; + src = fetchFromGitHub { owner = "dmlc"; repo = "xgboost"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; fetchSubmodules = true; hash = "sha256-khaD9gvKfUyWhkrIZXzGzKw/nfgeTcp9akCi5X3IORo="; }; @@ -62,15 +66,20 @@ effectiveStdenv.mkDerivation rec { cmake ] ++ lib.optionals effectiveStdenv.hostPlatform.isDarwin [ llvmPackages.openmp ] + ++ lib.optionals cudaSupport [ cudaPackages.cudatoolkit ] ++ lib.optionals cudaSupport [ autoAddDriverRunpath ] ++ lib.optionals rLibrary [ R ]; buildInputs = [ gtest ] - ++ lib.optional cudaSupport cudaPackages.cudatoolkit - ++ lib.optional cudaSupport cudaPackages.cuda_cudart - ++ lib.optional ncclSupport cudaPackages.nccl; + ++ lib.optionals stdenv.cc.isClang [ + llvmPackages.openmp # 'omp.h' file not found + ] + ++ lib.optionals cudaSupport [ + cudaPackages.cuda_cudart # cuda_runtime.h + ] + ++ lib.optionals ncclSupport [ cudaPackages.nccl ]; propagatedBuildInputs = lib.optionals rLibrary [ rPackages.data_table @@ -203,4 +212,4 @@ effectiveStdenv.mkDerivation rec { nviets ]; }; -} +})