summary refs log tree commit diff
path: root/pkgs/development/r-modules
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2021-01-18 10:29:56 +0100
committerMatthieu Coudron <mcoudron@hotmail.com>2021-01-18 10:35:35 +0100
commitef156fb8eda84d192b7af389528edeae50e5ca8b (patch)
tree172c415abe58449dcde3e63d399a081c968afd85 /pkgs/development/r-modules
parent68398d2dd50efc2d878bf0f83bbc8bc323b6b0e0 (diff)
downloadnixpkgs-ef156fb8eda84d192b7af389528edeae50e5ca8b.tar
nixpkgs-ef156fb8eda84d192b7af389528edeae50e5ca8b.tar.gz
nixpkgs-ef156fb8eda84d192b7af389528edeae50e5ca8b.tar.bz2
nixpkgs-ef156fb8eda84d192b7af389528edeae50e5ca8b.tar.lz
nixpkgs-ef156fb8eda84d192b7af389528edeae50e5ca8b.tar.xz
nixpkgs-ef156fb8eda84d192b7af389528edeae50e5ca8b.tar.zst
nixpkgs-ef156fb8eda84d192b7af389528edeae50e5ca8b.zip
rWrapper: use symlinkJoin instead of runCommand
While trying to build a haskell-project I got:

Configuring library for inline-r-0.10.4..
cabal: The pkg-config package 'libR' version ==3.0 || >3.0 is required but it
could not be found.

the rWrapper was only bringing the R binary without its companion
library: this fixes it.
Diffstat (limited to 'pkgs/development/r-modules')
-rw-r--r--pkgs/development/r-modules/wrapper.nix32
1 files changed, 21 insertions, 11 deletions
diff --git a/pkgs/development/r-modules/wrapper.nix b/pkgs/development/r-modules/wrapper.nix
index 76e819501a5..12704149666 100644
--- a/pkgs/development/r-modules/wrapper.nix
+++ b/pkgs/development/r-modules/wrapper.nix
@@ -1,21 +1,31 @@
-{ runCommand, R, makeWrapper, recommendedPackages, packages }:
-
-runCommand (R.name + "-wrapper") {
+{ symlinkJoin, R, makeWrapper, recommendedPackages, packages }:
+symlinkJoin {
+  name = R.name + "-wrapper";
   preferLocalBuild = true;
   allowSubstitutes = false;
 
   buildInputs = [R] ++ recommendedPackages ++ packages;
+  paths = [ R ];
 
   nativeBuildInputs = [makeWrapper];
 
+  postBuild = ''
+    cd ${R}/bin
+    for exe in *; do
+      rm "$out/bin/$exe"
+
+      makeWrapper "${R}/bin/$exe" "$out/bin/$exe" \
+        --prefix "R_LIBS_SITE" ":" "$R_LIBS_SITE"
+    done
+  '';
+
   # Make the list of recommended R packages accessible to other packages such as rpy2
   passthru = { inherit recommendedPackages; };
+
+    meta = R.meta // {
+      # To prevent builds on hydra
+      hydraPlatforms = [];
+      # prefer wrapper over the package
+      priority = (R.meta.priority or 0) - 1;
+    };
 }
-''
-mkdir -p $out/bin
-cd ${R}/bin
-for exe in *; do
-  makeWrapper ${R}/bin/$exe $out/bin/$exe \
-    --prefix "R_LIBS_SITE" ":" "$R_LIBS_SITE"
-done
-''