This PR sets default SPARK_HOME and JAVA_HOME for R's sparklyr package using a patch in .onload. Preset value take precedence. SPARK_HOME points to python3Packages.pyspark rather than pkgs.spark because the former is actively maintained.

This commit is contained in:
nviets 2023-03-03 18:31:19 -06:00 committed by Nathan Viets
parent 71d6662977
commit 62821edd2e

View file

@ -1275,6 +1275,17 @@ let
'';
});
sparklyr = old.sparklyr.overrideAttrs (attrs: {
# Pyspark's spark is full featured and better maintained than pkgs.spark
preConfigure = ''
substituteInPlace R/zzz.R \
--replace ".onLoad <- function(...) {" \
".onLoad <- function(...) {
Sys.setenv(\"SPARK_HOME\" = Sys.getenv(\"SPARK_HOME\", unset = \"${pkgs.python3Packages.pyspark}/lib/${pkgs.python3Packages.python.libPrefix}/site-packages/pyspark\"))
Sys.setenv(\"JAVA_HOME\" = Sys.getenv(\"JAVA_HOME\", unset = \"${pkgs.openjdk}\"))"
'';
});
proj4 = old.proj4.overrideAttrs (attrs: {
preConfigure = ''
substituteInPlace configure \