1 { stdenv, lib, R, libcxx, xvfb-run, util-linux, Cocoa, Foundation, gettext, gfortran, libiconv }:
3 { name, buildInputs ? [], requireX ? false, ... } @ attrs:
6 buildInputs = buildInputs ++ [R gettext] ++
7 lib.optionals requireX [util-linux xvfb-run] ++
8 lib.optionals stdenv.hostPlatform.isDarwin [Cocoa Foundation gfortran libiconv];
10 env.NIX_CFLAGS_COMPILE =
11 lib.optionalString stdenv.hostPlatform.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
13 enableParallelBuilding = true;
17 export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}"
18 export R_LIBS_SITE="$R_LIBS_SITE''${R_LIBS_SITE:+:}$out/library"
27 installFlags = if attrs.doCheck or true then
32 rCommand = if requireX then
33 # Unfortunately, xvfb-run has a race condition even with -a option, so that
34 # we acquire a lock explicitly.
35 "flock ${xvfb-run} xvfb-run -a -e xvfb-error R"
42 $rCommand CMD INSTALL --built-timestamp='1970-01-01 00:00:00 UTC' $installFlags --configure-args="$configureFlags" -l $out/library .
47 if test -e $out/nix-support/propagated-build-inputs; then
48 ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
53 # noop since R CMD INSTALL tests packages