about summary refs log tree commit diff
path: root/pkgs/development/r-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/r-modules')
-rw-r--r--pkgs/development/r-modules/wrapper-radian.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/pkgs/development/r-modules/wrapper-radian.nix b/pkgs/development/r-modules/wrapper-radian.nix
new file mode 100644
index 0000000000000..a0a23222b5232
--- /dev/null
+++ b/pkgs/development/r-modules/wrapper-radian.nix
@@ -0,0 +1,37 @@
+{ lib
+, runCommand
+, R
+, radian
+, makeWrapper
+, recommendedPackages
+, packages
+, wrapR ? false
+}:
+
+runCommand (radian.name + "-wrapper") {
+  preferLocalBuild = true;
+  allowSubstitutes = false;
+
+  buildInputs = [ radian ] ++ recommendedPackages ++ packages
+    ++ lib.optional wrapR R;
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  passthru = { inherit recommendedPackages; };
+
+  meta = radian.meta // {
+    # To prevent builds on hydra
+    hydraPlatforms = [ ];
+    # prefer wrapper over the package
+    priority = (radian.meta.priority or 0) - 1;
+  };
+} (''
+  makeWrapper "${radian}/bin/radian" "$out/bin/radian" \
+    --prefix "R_LIBS_SITE" ":" "$R_LIBS_SITE"
+'' + lib.optionalString wrapR ''
+  cd ${R}/bin
+  for exe in *; do
+    makeWrapper "${R}/bin/$exe" "$out/bin/$exe" \
+      --prefix "R_LIBS_SITE" ":" "$R_LIBS_SITE"
+  done
+'')