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.
This commit is contained in:
Savyasachee Jha 2023-04-16 16:05:06 +05:30
parent 580693af11
commit e7c6fb0f86

View file

@ -12,8 +12,7 @@ runCommand (radian.name + "-wrapper") {
preferLocalBuild = true;
allowSubstitutes = false;
buildInputs = [ radian ] ++ recommendedPackages ++ packages
++ lib.optional wrapR R;
buildInputs = [ R radian ] ++ recommendedPackages ++ packages;
nativeBuildInputs = [ makeWrapper ];
@ -27,7 +26,8 @@ runCommand (radian.name + "-wrapper") {
};
} (''
makeWrapper "${radian}/bin/radian" "$out/bin/radian" \
--prefix "R_LIBS_SITE" ":" "$R_LIBS_SITE"
--prefix "R_LIBS_SITE" ":" "$R_LIBS_SITE" \
--set "R_HOME" "${R}/lib/R"
'' + lib.optionalString wrapR ''
cd ${R}/bin
for exe in *; do