rPackages.RBioFormats: vendor BioFormats from nixpkgs

This commit is contained in:
László Kupcsik
2025-11-12 22:17:29 +01:00
parent 2ad807559b
commit 6772a554bb

View File

@@ -1758,7 +1758,6 @@ let
"Rmpi" # tries to run MPI processes
"ReactomeContentService4R" # tries to connect to Reactome
"PhIPData" # tries to download something from a DB
"RBioFormats" # tries to download jar during load test
"pbdMPI" # tries to run MPI processes
"CTdata" # tries to connect to ExperimentHub
"rfaRm" # tries to connect to Ebi
@@ -2021,6 +2020,34 @@ let
'';
});
RBioFormats = old.RBioFormats.overrideAttrs (attrs: {
# 1. Never download the jar file
# 2. Use jar from pkgs.bftools instead
# 3. Break the build if versions don't match
propagatedBuildInputs = (attrs.propagatedBuildInputs or [ ]) ++ [ pkgs.bftools ];
postPatch = ''
substituteInPlace "R/zzz.R" \
--replace-fail '!file.exists(bf_jar)' 'FALSE' \
--replace-fail \
'.jpackage(pkg, lib.loc = lib, morePaths = c(jars, bf_jar))' \
'.jpackage(pkg, lib.loc = lib, morePaths = union(jars, "${lib.getBin pkgs.bftools}/share/java/bioformats_package.jar"))' \
--replace-fail 'bf_jar <-' 'stopifnot(bf_ver == "${pkgs.bftools.version}");bf_jar <-'
'';
# Ensure that bftools version matches that in the package DESCRIPTION
preInstall = ''
rbf_version="$(sed -n 's/^BioFormats: //p' DESCRIPTION)"
bf_version="${pkgs.bftools.version}"
if [ "$rbf_version" != "$bf_version" ]; then
echo "BioFormats version mismatch detected!"
echo "RBioformats needs: $rbf_version"
echo "bftools provides: $bf_version"
exit 1
fi
'';
});
rbm25 = old.rbm25.overrideAttrs (attrs: {
postPatch = "patchShebangs configure";
});