forked from mirrors/nixpkgs
da19c34d0f
This continues #23374, which always kept around both attributes, by always including both propagated files: `propgated-native-build-inputs` and `propagated-build-inputs`. `nativePkgs` and `crossPkgs` are still defined as before, however, so this change should only barely observable. This is an incremental step to fully keeping the dependencies separate in all cases.
55 lines
1.5 KiB
Nix
55 lines
1.5 KiB
Nix
{ stdenv, R, libcxx, xvfb_run, utillinux, Cocoa, Foundation, gettext, gfortran }:
|
|
|
|
{ name, buildInputs ? [], ... } @ attrs:
|
|
|
|
stdenv.mkDerivation ({
|
|
buildInputs = buildInputs ++ [R] ++
|
|
stdenv.lib.optionals attrs.requireX [utillinux xvfb_run] ++
|
|
stdenv.lib.optionals stdenv.isDarwin [Cocoa Foundation gettext gfortran];
|
|
|
|
NIX_CFLAGS_COMPILE =
|
|
stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
|
|
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
export R_LIBS_SITE="$R_LIBS_SITE''${R_LIBS_SITE:+:}$out/library"
|
|
runHook postConfigure
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
runHook postBuild
|
|
'';
|
|
|
|
installFlags = if attrs.doCheck or true then
|
|
[]
|
|
else
|
|
[ "--no-test-load" ];
|
|
|
|
rCommand = if attrs.requireX or false then
|
|
# Unfortunately, xvfb-run has a race condition even with -a option, so that
|
|
# we acquire a lock explicitly.
|
|
"flock ${xvfb_run} xvfb-run -a -e xvfb-error R"
|
|
else
|
|
"R";
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/library
|
|
$rCommand CMD INSTALL $installFlags --configure-args="$configureFlags" -l $out/library .
|
|
runHook postInstall
|
|
'';
|
|
|
|
postFixup = ''
|
|
if test -e $out/nix-support/propagated-build-inputs; then
|
|
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
|
|
fi
|
|
'';
|
|
|
|
checkPhase = ''
|
|
# noop since R CMD INSTALL tests packages
|
|
'';
|
|
} // attrs // {
|
|
name = "r-" + name;
|
|
})
|