2021-02-05 17:12:51 +00:00
|
|
|
{ symlinkJoin, R, makeWrapper, recommendedPackages, packages }:
|
|
|
|
symlinkJoin {
|
|
|
|
name = R.name + "-wrapper";
|
2020-04-24 23:36:52 +00:00
|
|
|
preferLocalBuild = true;
|
|
|
|
allowSubstitutes = false;
|
|
|
|
|
|
|
|
buildInputs = [R] ++ recommendedPackages ++ packages;
|
2021-02-05 17:12:51 +00:00
|
|
|
paths = [ R ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [makeWrapper];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Make the list of recommended R packages accessible to other packages such as rpy2
|
|
|
|
passthru = { inherit recommendedPackages; };
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
meta = R.meta // {
|
|
|
|
# To prevent builds on hydra
|
|
|
|
hydraPlatforms = [];
|
|
|
|
# prefer wrapper over the package
|
|
|
|
priority = (R.meta.priority or 0) - 1;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|