depot/pkgs/development/r-modules/wrapper.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

31 lines
815 B
Nix

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