bscpkgs/garlic/pp/rplot.nix

37 lines
608 B
Nix
Raw Normal View History

{
stdenv
, rWrapper
, rPackages
2021-03-12 19:53:24 +01:00
, fontconfig
}:
{
# The two results to be compared
dataset
, script
, extraRPackages ? []
}:
with stdenv.lib;
let
customR = rWrapper.override {
packages = with rPackages; [ tidyverse viridis egg ] ++ extraRPackages;
};
in stdenv.mkDerivation {
name = "plot";
buildInputs = [ customR ];
preferLocalBuild = true;
dontPatchShebangs = true;
phases = [ "installPhase" ];
installPhase = ''
2021-03-12 19:53:24 +01:00
export FONTCONFIG_PATH=${fontconfig.out}/etc/fonts
mkdir -p $out
cd $out
ln -s ${dataset} input
Rscript --vanilla ${script} ${dataset}
'';
}