rPackages.{Rhtslib,h2o,rmarkdown,tesseract}: use --replace-fail; rPackages.proj4: remove substitution; rPackages.sparklyr: improve onLoad logic (#417578)

This commit is contained in:
Justin Bedő
2025-06-20 08:09:08 +10:00
committed by GitHub
+14 -15
View File
@@ -2523,7 +2523,7 @@ let
Rhtslib = old.Rhtslib.overrideAttrs (attrs: {
preConfigure = ''
substituteInPlace R/zzz.R --replace "-lcurl" "-L${pkgs.curl.out}/lib -lcurl"
substituteInPlace R/zzz.R --replace-fail "-lcurl" "-L${pkgs.curl.out}/lib -lcurl"
'';
});
@@ -2534,7 +2534,7 @@ let
# during runtime the package directory is not writable as it's in the
# nix store, so store the jar in the user's cache directory instead
substituteInPlace R/connection.R --replace \
substituteInPlace R/connection.R --replace-fail \
'dest_file <- file.path(dest_folder, "h2o.jar")' \
'dest_file <- file.path("~/.cache/", "h2o.jar")'
'';
@@ -2572,18 +2572,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}/${pkgs.python3Packages.python.sitePackages}/pyspark\"))
Sys.setenv(\"JAVA_HOME\" = Sys.getenv(\"JAVA_HOME\", unset = \"${pkgs.jdk}\"))"
'';
});
if grep "onLoad" R/zzz.R; then
echo "onLoad is already present, patch needs to be updated!"
exit 1
fi
proj4 = old.proj4.overrideAttrs (attrs: {
preConfigure = ''
substituteInPlace configure \
--replace "-lsqlite3" "-L${lib.makeLibraryPath [ pkgs.sqlite ]} -lsqlite3"
cat >> R/zzz.R <<EOF
.onLoad <- function(...) {
Sys.setenv("SPARK_HOME" = Sys.getenv("SPARK_HOME", unset = "${pkgs.python3Packages.pyspark}/${pkgs.python3Packages.python.sitePackages}/pyspark"))
Sys.setenv("JAVA_HOME" = Sys.getenv("JAVA_HOME", unset = "${pkgs.jdk}"))
}
EOF
'';
});
@@ -2674,7 +2673,7 @@ let
rmarkdown = old.rmarkdown.overrideAttrs (_: {
preConfigure = ''
substituteInPlace R/pandoc.R \
--replace '"~/opt/pandoc"' '"~/opt/pandoc", "${pkgs.pandoc}/bin"'
--replace-fail '"~/opt/pandoc"' '"~/opt/pandoc", "${pkgs.pandoc}/bin"'
'';
});
@@ -2700,7 +2699,7 @@ let
tesseract = old.tesseract.overrideAttrs (_: {
preConfigure = ''
substituteInPlace configure \
--replace 'PKG_CONFIG_NAME="tesseract"' 'PKG_CONFIG_NAME="tesseract lept"'
--replace-fail 'PKG_CONFIG_NAME="tesseract"' 'PKG_CONFIG_NAME="tesseract lept"'
'';
});