summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-02-14 09:53:03 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-14 09:53:03 +0000
commit200610b849c0aeb174a63e7526b7376aa8a339bf (patch)
treef57988f969df0344ef355473653daf0939a0d402 /pkgs/development/libraries
parentfa169bb239d7b2d860af851573569182ee5e0127 (diff)
parent46cc80cc78abdacca55f036a4f0341b96d660255 (diff)
downloadnixpkgs-200610b849c0aeb174a63e7526b7376aa8a339bf.tar
nixpkgs-200610b849c0aeb174a63e7526b7376aa8a339bf.tar.gz
nixpkgs-200610b849c0aeb174a63e7526b7376aa8a339bf.tar.bz2
nixpkgs-200610b849c0aeb174a63e7526b7376aa8a339bf.tar.lz
nixpkgs-200610b849c0aeb174a63e7526b7376aa8a339bf.tar.xz
nixpkgs-200610b849c0aeb174a63e7526b7376aa8a339bf.tar.zst
nixpkgs-200610b849c0aeb174a63e7526b7376aa8a339bf.zip
Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
	pkgs/development/libraries/gtest/default.nix
	pkgs/development/libraries/hidapi/default.nix
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/arrow-cpp/default.nix2
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix15
-rw-r--r--pkgs/development/libraries/gtest/default.nix10
-rw-r--r--pkgs/development/libraries/hidapi/default.nix15
-rw-r--r--pkgs/development/libraries/icu/63.nix6
-rw-r--r--pkgs/development/libraries/icu/base.nix10
-rw-r--r--pkgs/development/libraries/imlib2/default.nix10
-rw-r--r--pkgs/development/libraries/libb2/default.nix10
-rw-r--r--pkgs/development/libraries/liburing/default.nix4
-rw-r--r--pkgs/development/libraries/openssl/default.nix14
-rw-r--r--pkgs/development/libraries/science/math/liblapack/default.nix14
-rw-r--r--pkgs/development/libraries/webkitgtk/default.nix8
-rw-r--r--pkgs/development/libraries/xgboost/default.nix117
13 files changed, 168 insertions, 67 deletions
diff --git a/pkgs/development/libraries/arrow-cpp/default.nix b/pkgs/development/libraries/arrow-cpp/default.nix
index 76e117e57ce..4bebd827145 100644
--- a/pkgs/development/libraries/arrow-cpp/default.nix
+++ b/pkgs/development/libraries/arrow-cpp/default.nix
@@ -262,7 +262,7 @@ stdenv.mkDerivation rec {
     description = "A cross-language development platform for in-memory data";
     homepage = "https://arrow.apache.org/docs/cpp/";
     license = licenses.asl20;
-    broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin; # waiting on gtest changes in staging
+    broken = stdenv.isLinux && stdenv.isAarch64; # waiting on gtest changes in staging
     platforms = platforms.unix;
     maintainers = with maintainers; [ tobim veprbl cpcloud ];
   };
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index dceada0f7f8..d0374c74901 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -266,6 +266,10 @@
 , MediaToolbox
 , VideoDecodeAcceleration
 , VideoToolbox
+/*
+ *  Testing
+ */
+, testers
 }:
 
 /* Maintainer notes:
@@ -321,13 +325,13 @@ assert buildAvformat -> buildAvcodec && buildAvutil; # configure flag since 0.6
 assert buildPostproc -> buildAvutil;
 assert buildSwscale -> buildAvutil;
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "ffmpeg" + (if ffmpegVariant == "small" then "" else "-${ffmpegVariant}");
   inherit version;
 
   src = fetchgit {
     url = "https://git.ffmpeg.org/ffmpeg.git";
-    rev = "n${version}";
+    rev = "n${finalAttrs.version}";
     inherit sha256;
   };
 
@@ -522,7 +526,7 @@ stdenv.mkDerivation rec {
   # outputs where we don't want them. Patch the generated config.h to remove all
   # such references except for data.
   postConfigure = let
-    toStrip = lib.remove "data" outputs; # We want to keep references to the data dir.
+    toStrip = lib.remove "data" finalAttrs.outputs; # We want to keep references to the data dir.
   in
     "remove-references-to ${lib.concatStringsSep " " (map (o: "-t ${placeholder o}") toStrip)} config.h";
 
@@ -656,6 +660,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
   meta = with lib; {
     description = "A complete, cross-platform solution to record, convert and stream audio and video";
     homepage = "https://www.ffmpeg.org/";
@@ -671,7 +677,8 @@ stdenv.mkDerivation rec {
       ++ optional withGPL gpl2Plus
       ++ optional withGPLv3 gpl3Plus
       ++ optional withUnfree unfreeRedistributable;
+    pkgConfigModules = [ "libavutil" ];
     platforms = platforms.all;
     maintainers = with maintainers; [ atemu ];
   };
-}
+})
diff --git a/pkgs/development/libraries/gtest/default.nix b/pkgs/development/libraries/gtest/default.nix
index d4815c7aedc..80013e3613d 100644
--- a/pkgs/development/libraries/gtest/default.nix
+++ b/pkgs/development/libraries/gtest/default.nix
@@ -1,4 +1,10 @@
-{ lib, stdenv, cmake, ninja, fetchFromGitHub }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, ninja
+, static ? stdenv.hostPlatform.isStatic,
+}:
 
 stdenv.mkDerivation rec {
   pname = "gtest";
@@ -20,7 +26,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ninja ];
 
   cmakeFlags = [
-    "-DBUILD_SHARED_LIBS=ON"
+    "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
   ] ++ lib.optionals (
     (stdenv.cc.isGNU && (lib.versionOlder stdenv.cc.version "11.0"))
     || (stdenv.cc.isClang && (lib.versionOlder stdenv.cc.version "16.0"))
diff --git a/pkgs/development/libraries/hidapi/default.nix b/pkgs/development/libraries/hidapi/default.nix
index 2a6483d77b2..89cff8ef427 100644
--- a/pkgs/development/libraries/hidapi/default.nix
+++ b/pkgs/development/libraries/hidapi/default.nix
@@ -7,16 +7,17 @@
 , udev
 , Cocoa
 , IOKit
+, testers
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "hidapi";
   version = "0.13.1";
 
   src = fetchFromGitHub {
     owner = "libusb";
     repo = "hidapi";
-    rev = "${pname}-${version}";
+    rev = "${finalAttrs.pname}-${finalAttrs.version}";
     sha256 = "sha256-CEZP5n8qEAzsqn8dz3u1nG0YoT7J1P+WfN7urkRTuVg=";
   };
 
@@ -28,12 +29,20 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = lib.optionals stdenv.isDarwin [ Cocoa IOKit ];
 
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
   meta = with lib; {
     description = "Library for communicating with USB and Bluetooth HID devices";
     homepage = "https://github.com/libusb/hidapi";
     maintainers = with maintainers; [ prusnak ];
     # You can choose between GPLv3, BSD or HIDAPI license (even more liberal)
     license = with licenses; [ bsd3 /* or */ gpl3Only ] ;
+    pkgConfigModules = lib.optionals stdenv.isDarwin [
+      "hidapi"
+    ] ++ lib.optionals stdenv.isLinux [
+      "hidapi-hidraw"
+      "hidapi-libusb"
+    ];
     platforms = platforms.unix;
   };
-}
+})
diff --git a/pkgs/development/libraries/icu/63.nix b/pkgs/development/libraries/icu/63.nix
index 19838763f5b..a83e2cd5f5e 100644
--- a/pkgs/development/libraries/icu/63.nix
+++ b/pkgs/development/libraries/icu/63.nix
@@ -1,4 +1,6 @@
-{ stdenv, lib, fetchurl, fetchpatch, fixDarwinDylibNames, nativeBuildRoot, buildRootOnly ? false }:
+{ stdenv, lib, fetchurl, fetchpatch, fixDarwinDylibNames, nativeBuildRoot, testers
+, buildRootOnly ? false
+}:
 
 import ./base.nix {
   version = "63.1";
@@ -11,4 +13,4 @@ import ./base.nix {
     })
   ];
   patchFlags = [ "-p3" ];
-} { inherit stdenv lib fetchurl fixDarwinDylibNames nativeBuildRoot buildRootOnly; }
+} { inherit stdenv lib fetchurl fixDarwinDylibNames nativeBuildRoot testers buildRootOnly; }
diff --git a/pkgs/development/libraries/icu/base.nix b/pkgs/development/libraries/icu/base.nix
index a714e758bd8..c5e46fa4530 100644
--- a/pkgs/development/libraries/icu/base.nix
+++ b/pkgs/development/libraries/icu/base.nix
@@ -2,6 +2,7 @@
 { stdenv, lib, fetchurl, fixDarwinDylibNames
   # Cross-compiled icu4c requires a build-root of a native compile
 , buildRootOnly ? false, nativeBuildRoot
+, testers
 }:
 
 let
@@ -45,6 +46,11 @@ let
       description = "Unicode and globalization support library";
       homepage = "https://icu.unicode.org/";
       maintainers = with maintainers; [ raskin ];
+      pkgConfigModules = [
+        "icu-i18n"
+        "icu-io"
+        "icu-uc"
+      ];
       platforms = platforms.all;
     };
   };
@@ -97,4 +103,6 @@ let
             then buildRootOnlyAttrs
           else realAttrs;
 in
-stdenv.mkDerivation attrs
+stdenv.mkDerivation (finalAttrs: attrs // {
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+})
diff --git a/pkgs/development/libraries/imlib2/default.nix b/pkgs/development/libraries/imlib2/default.nix
index 66092f43650..02707c750c0 100644
--- a/pkgs/development/libraries/imlib2/default.nix
+++ b/pkgs/development/libraries/imlib2/default.nix
@@ -21,17 +21,18 @@
 , fluxbox
 , enlightenment
 , xorg
+, testers
 }:
 
 let
   inherit (lib) optional optionals;
 in
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "imlib2";
   version = "1.9.1";
 
   src = fetchurl {
-    url = "mirror://sourceforge/enlightenment/${pname}-${version}.tar.xz";
+    url = "mirror://sourceforge/enlightenment/${finalAttrs.pname}-${finalAttrs.version}.tar.xz";
     hash = "sha256-SiJAOL//vl1NJQxE4F9O5a4k3P74OVsWd8cVxY92TUM=";
   };
 
@@ -69,6 +70,8 @@ stdenv.mkDerivation rec {
       enlightenment;
   };
 
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
   meta = with lib; {
     description = "Image manipulation library";
 
@@ -83,7 +86,8 @@ stdenv.mkDerivation rec {
     homepage = "https://docs.enlightenment.org/api/imlib2/html";
     changelog = "https://git.enlightenment.org/legacy/imlib2.git/plain/ChangeLog?h=v${version}";
     license = licenses.imlib2;
+    pkgConfigModules = [ "imlib2" ];
     platforms = platforms.unix;
     maintainers = with maintainers; [ spwhitt ];
   };
-}
+})
diff --git a/pkgs/development/libraries/libb2/default.nix b/pkgs/development/libraries/libb2/default.nix
index a461f5039aa..9e507188aad 100644
--- a/pkgs/development/libraries/libb2/default.nix
+++ b/pkgs/development/libraries/libb2/default.nix
@@ -4,16 +4,17 @@
 , autoreconfHook
 , libtool
 , pkg-config
+, testers
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "libb2";
   version = "0.98.1";
 
   src = fetchFromGitHub {
     owner = "BLAKE2";
     repo = "libb2";
-    rev = "refs/tags/v${version}";
+    rev = "refs/tags/v${finalAttrs.version}";
     sha256 = "0qj8aaqvfcavj1vj5asm4pqm03ap7q8x4c2fy83cqggvky0frgya";
   };
 
@@ -29,11 +30,14 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
   meta = with lib; {
     description = "The BLAKE2 family of cryptographic hash functions";
     homepage = "https://blake2.net/";
+    pkgConfigModules = [ "libb2" ];
     platforms = platforms.all;
     maintainers = with maintainers; [ dfoxfranke dotlambda ];
     license = licenses.cc0;
   };
-}
+})
diff --git a/pkgs/development/libraries/liburing/default.nix b/pkgs/development/libraries/liburing/default.nix
index c95ea31b3bf..7a5fa8a34a1 100644
--- a/pkgs/development/libraries/liburing/default.nix
+++ b/pkgs/development/libraries/liburing/default.nix
@@ -4,12 +4,12 @@
 
 stdenv.mkDerivation rec {
   pname = "liburing";
-  version = "2.2";
+  version = "2.3";
 
   src = fetchgit {
     url    = "http://git.kernel.dk/${pname}";
     rev    = "liburing-${version}";
-    sha256 = "sha256-M/jfxZ+5DmFvlAt8sbXrjBTPf2gLd9UyTNymtjD+55g";
+    sha256 = "sha256-vN6lLb5kpgHTKDxwibJPS61sdelILETVtJE2BYgp79k=";
   };
 
   separateDebugInfo = true;
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 488613fd489..75ffe5ae06a 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -10,6 +10,7 @@
 # path to openssl.cnf file. will be placed in $etc/etc/ssl/openssl.cnf to replace the default
 , conf ? null
 , removeReferencesTo
+, testers
 }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
@@ -19,12 +20,12 @@
 
 let
   common = { version, sha256, patches ? [], withDocs ? false, extraMeta ? {} }:
-   stdenv.mkDerivation rec {
+   stdenv.mkDerivation (finalAttrs: {
     pname = "openssl";
     inherit version;
 
     src = fetchurl {
-      url = "https://www.openssl.org/source/${pname}-${version}.tar.gz";
+      url = "https://www.openssl.org/source/${finalAttrs.pname}-${version}.tar.gz";
       inherit sha256;
     };
 
@@ -204,13 +205,20 @@ let
       fi
     '';
 
+    passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
     meta = with lib; {
       homepage = "https://www.openssl.org/";
       description = "A cryptographic library that implements the SSL and TLS protocols";
       license = licenses.openssl;
+      pkgConfigModules = [
+        "libcrypto"
+        "libssl"
+        "openssl"
+      ];
       platforms = platforms.all;
     } // extraMeta;
-  };
+  });
 
 in {
 
diff --git a/pkgs/development/libraries/science/math/liblapack/default.nix b/pkgs/development/libraries/science/math/liblapack/default.nix
index b9563346ada..3bf16057f83 100644
--- a/pkgs/development/libraries/science/math/liblapack/default.nix
+++ b/pkgs/development/libraries/science/math/liblapack/default.nix
@@ -6,16 +6,17 @@
 , shared ? true
 # Compile with ILP64 interface
 , blas64 ? false
+, testers
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "liblapack";
   version = "3.11";
 
   src = fetchFromGitHub {
     owner = "Reference-LAPACK";
     repo = "lapack";
-    rev = "v${version}";
+    rev = "v${finalAttrs.version}";
     sha256 = "sha256-AYD78u70y8cY19hmM/aDjQEzxO8u9lPWhCFxRe5cqXI=";
   };
 
@@ -40,7 +41,7 @@ stdenv.mkDerivation rec {
 
   postInstall =  let
     canonicalExtension = if stdenv.hostPlatform.isLinux
-                       then "${stdenv.hostPlatform.extensions.sharedLibrary}.${lib.versions.major version}"
+                       then "${stdenv.hostPlatform.extensions.sharedLibrary}.${lib.versions.major finalAttrs.version}"
                        else stdenv.hostPlatform.extensions.sharedLibrary;
   in lib.optionalString blas64 ''
     ln -s $out/lib/liblapack64${canonicalExtension} $out/lib/liblapack${canonicalExtension}
@@ -65,15 +66,18 @@ stdenv.mkDerivation rec {
 
   checkPhase = ''
     runHook preCheck
-    ctest ${ctestArgs}
+    ctest ${finalAttrs.ctestArgs}
     runHook postCheck
   '';
 
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
   meta = with lib; {
     description = "Linear Algebra PACKage";
     homepage = "http://www.netlib.org/lapack/";
     maintainers = with maintainers; [ markuskowa ];
     license = licenses.bsd3;
+    pkgConfigModules = [ "lapack" ];
     platforms = platforms.all;
   };
-}
+})
diff --git a/pkgs/development/libraries/webkitgtk/default.nix b/pkgs/development/libraries/webkitgtk/default.nix
index 99ee89edcac..fdefeb86a04 100644
--- a/pkgs/development/libraries/webkitgtk/default.nix
+++ b/pkgs/development/libraries/webkitgtk/default.nix
@@ -64,6 +64,7 @@
 , enableGeoLocation ? true
 , withLibsecret ? true
 , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
+, testers
 }:
 
 stdenv.mkDerivation (finalAttrs: {
@@ -232,10 +233,17 @@ stdenv.mkDerivation (finalAttrs: {
 
   requiredSystemFeatures = [ "big-parallel" ];
 
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
   meta = with lib; {
     description = "Web content rendering engine, GTK port";
     homepage = "https://webkitgtk.org/";
     license = licenses.bsd2;
+    pkgConfigModules = [
+      "javascriptcoregtk-4.0"
+      "webkit2gtk-4.0"
+      "webkit2gtk-web-extension-4.0"
+    ];
     platforms = platforms.linux ++ platforms.darwin;
     maintainers = teams.gnome.members;
     broken = stdenv.isDarwin;
diff --git a/pkgs/development/libraries/xgboost/default.nix b/pkgs/development/libraries/xgboost/default.nix
index bf2825b5967..4370a27012d 100644
--- a/pkgs/development/libraries/xgboost/default.nix
+++ b/pkgs/development/libraries/xgboost/default.nix
@@ -1,69 +1,110 @@
-{ config
-, stdenv
-, lib
-, fetchFromGitHub
-, cmake
-, gtest
-, doCheck ? true
-, cudaSupport ? config.cudaSupport or false
-, ncclSupport ? false
-, cudaPackages
-, llvmPackages
-}:
+{ config, stdenv, lib, fetchFromGitHub, cmake, gtest, doCheck ? true
+, cudaSupport ? config.cudaSupport or false, ncclSupport ? false
+, rLibrary ? false, cudaPackages, llvmPackages, R, rPackages }:
 
 assert ncclSupport -> cudaSupport;
+# Disable regular tests when building the R package
+# because 1) the R package runs its own tests and
+# 2) the R package creates a different binary shared
+# object that isn't compatible with the regular CLI
+# tests.
+assert rLibrary -> doCheck != true;
 
 stdenv.mkDerivation rec {
-  pname = "xgboost";
+  pnameBase = "xgboost";
+  # prefix with r when building the R library
+  # The R package build results in a special xgboost.so file
+  # that contains a subset of the .so file use for the CLI
+  # and python version. In general, the CRAN version from
+  # nixpkgs's r-modules should be used, but this non-standard
+  # build allows for enabling CUDA and NCCL support which aren't
+  # included in the CRAN release. Build with:
+  # nix-build -E "with (import $NIXPKGS{}); \
+  #   let \
+  #     xgb = xgboost.override{rLibrary = true; doCheck = false;}; \
+  #   in \
+  #   rWrapper.override{ packages = [ xgb ]; }"
+  pname = lib.optionalString rLibrary "r-" + pnameBase;
   version = "1.7.3";
 
   src = fetchFromGitHub {
     owner = "dmlc";
-    repo = pname;
+    repo = pnameBase;
     rev = "v${version}";
     fetchSubmodules = true;
     hash = "sha256-unTss2byytG8KUQfg5s34YpRuHHDLo7D/ZickHhz1AE=";
   };
 
-  nativeBuildInputs = [
-    cmake
-  ] ++ lib.optionals stdenv.isDarwin [
-    llvmPackages.openmp
-  ] ++ lib.optionals cudaSupport [
-    cudaPackages.autoAddOpenGLRunpathHook
-  ];
+  nativeBuildInputs = [ cmake ]
+    ++ lib.optionals stdenv.isDarwin [ llvmPackages.openmp ]
+    ++ lib.optionals cudaSupport [ cudaPackages.autoAddOpenGLRunpathHook ]
+    ++ lib.optionals rLibrary [ R ];
 
   buildInputs = [ gtest ] ++ lib.optional cudaSupport cudaPackages.cudatoolkit
-                ++ lib.optional ncclSupport cudaPackages.nccl;
+    ++ lib.optional ncclSupport cudaPackages.nccl;
+
+  propagatedBuildInputs = lib.optionals rLibrary [
+    rPackages.data_table
+    rPackages.jsonlite
+    rPackages.Matrix
+  ];
 
   cmakeFlags = lib.optionals doCheck [ "-DGOOGLE_TEST=ON" ]
-    ++ lib.optionals cudaSupport [ "-DUSE_CUDA=ON" "-DCUDA_HOST_COMPILER=${cudaPackages.cudatoolkit.cc}/bin/cc" ]
-    ++ lib.optionals (cudaSupport && lib.versionAtLeast cudaPackages.cudatoolkit.version "11.4.0") [ "-DBUILD_WITH_CUDA_CUB=ON" ]
-    ++ lib.optionals ncclSupport [ "-DUSE_NCCL=ON" ];
+    ++ lib.optionals cudaSupport [
+      "-DUSE_CUDA=ON"
+      "-DCUDA_HOST_COMPILER=${cudaPackages.cudatoolkit.cc}/bin/cc"
+    ] ++ lib.optionals (cudaSupport
+      && lib.versionAtLeast cudaPackages.cudatoolkit.version "11.4.0")
+    [ "-DBUILD_WITH_CUDA_CUB=ON" ]
+    ++ lib.optionals ncclSupport [ "-DUSE_NCCL=ON" ]
+    ++ lib.optionals rLibrary [ "-DR_LIB=ON" ];
+
+  preConfigure = lib.optionals rLibrary ''
+    substituteInPlace cmake/RPackageInstall.cmake.in --replace "CMD INSTALL" "CMD INSTALL -l $out/library"
+    export R_LIBS_SITE="$R_LIBS_SITE''${R_LIBS_SITE:+:}$out/library"
+  '';
 
   inherit doCheck;
 
   # By default, cmake build will run ctests with all checks enabled
   # If we're building with cuda, we run ctest manually so that we can skip the GPU tests
   checkPhase = lib.optionalString cudaSupport ''
-    ctest --force-new-ctest-process ${lib.optionalString cudaSupport "-E TestXGBoostLib"}
+    ctest --force-new-ctest-process ${
+      lib.optionalString cudaSupport "-E TestXGBoostLib"
+    }
   '';
 
-  installPhase = let
-    libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
-  in ''
-    runHook preInstall
-    mkdir -p $out
-    cp -r ../include $out
-    cp -r ../dmlc-core/include/dmlc $out/include
-    cp -r ../rabit/include/rabit $out/include
-    install -Dm755 ../lib/${libname} $out/lib/${libname}
-    install -Dm755 ../xgboost $out/bin/xgboost
-    runHook postInstall
+  installPhase =
+    let libname = "libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
+    in ''
+      runHook preInstall
+      mkdir -p $out
+      cp -r ../include $out
+      cp -r ../dmlc-core/include/dmlc $out/include
+      cp -r ../rabit/include/rabit $out/include
+    '' + lib.optionalString (!rLibrary) ''
+      install -Dm755 ../lib/${libname} $out/lib/${libname}
+      install -Dm755 ../xgboost $out/bin/xgboost
+    ''
+    # the R library option builds a completely different binary xgboost.so instead of
+    # libxgboost.so, which isn't full featured for python and CLI
+    + lib.optionalString rLibrary ''
+      mkdir $out/library
+      export R_LIBS_SITE="$out/library:$R_LIBS_SITE''${R_LIBS_SITE:+:}"
+      make install -l $out/library
+    '' + ''
+      runHook postInstall
+    '';
+
+  postFixup = lib.optionalString rLibrary ''
+    if test -e $out/nix-support/propagated-build-inputs; then
+        ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
+    fi
   '';
 
   meta = with lib; {
-    description = "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
+    description =
+      "Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library";
     homepage = "https://github.com/dmlc/xgboost";
     license = licenses.asl20;
     platforms = platforms.unix;