nixpkgs/pkgs/development/r-modules/wrapper-radian.nix
Savyasachee Jha e7c6fb0f86 radianWrapper: Explicitly set R_HOME and always have R in buildInputs
Before this commit, `wrapR = false` (the default) would lead to
situations where the `RHOME` variable would not be found. Adding `--set
R_HOME ${R}/lib/R` so that the wrapper explicitly exports `R_HOME` fixes
this issue. In addition, R is also made part of `buildInputs` by default
so that package loading works correctly.
2023-04-29 18:24:06 +05:30

38 lines
843 B
Nix

{ lib
, runCommand
, R
, radian
, makeWrapper
, recommendedPackages
, packages
, wrapR ? false
}:
runCommand (radian.name + "-wrapper") {
preferLocalBuild = true;
allowSubstitutes = false;
buildInputs = [ R radian ] ++ recommendedPackages ++ packages;
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" \
--set "R_HOME" "${R}/lib/R"
'' + 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
'')