1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00

rstudioWrapper: use runCommand, local build only

This seems more appropriate for a wrapper generator.
This commit is contained in:
Joachim Fasting 2018-12-05 19:04:04 +01:00
parent d2b467a2de
commit 21d83e5b11
No known key found for this signature in database
GPG key ID: 5C204DF675C90294

View file

@ -1,15 +1,15 @@
{ stdenv, R, rstudio, makeWrapper, recommendedPackages, packages, qtbase }:
{ lib, runCommand, R, rstudio, makeWrapper, recommendedPackages, packages, qtbase }:
let
qtVersion = with stdenv.lib.versions; "${major qtbase.version}.${minor qtbase.version}";
qtVersion = with lib.versions; "${major qtbase.version}.${minor qtbase.version}";
in
stdenv.mkDerivation rec {
runCommand (rstudio.name + "-wrapper") {
preferLocalBuild = true;
allowSubstitutes = false;
name = rstudio.name + "-wrapper";
nativeBuildInputs = [makeWrapper];
buildInputs = [makeWrapper R rstudio] ++ recommendedPackages ++ packages;
unpackPhase = ":";
buildInputs = [R rstudio] ++ recommendedPackages ++ packages;
# rWrapper points R to a specific set of packages by using a wrapper
# (as in https://nixos.org/nixpkgs/manual/#r-packages) which sets
@ -20,18 +20,14 @@ stdenv.mkDerivation rec {
# into an R file (fixLibsR) which achieves the same effect, then
# uses R_PROFILE_USER to load this code at startup in RStudio.
fixLibsR = "fix_libs.R";
installPhase = ''
mkdir $out
echo "# Autogenerated by wrapper-rstudio.nix from R_LIBS_SITE" > $out/${fixLibsR}
echo -n ".libPaths(c(.libPaths(), \"" >> $out/${fixLibsR}
echo -n $R_LIBS_SITE | sed -e 's/:/", "/g' >> $out/${fixLibsR}
echo -n "\"))" >> $out/${fixLibsR}
echo >> $out/${fixLibsR}
makeWrapper ${rstudio}/bin/rstudio $out/bin/rstudio --set R_PROFILE_USER $out/${fixLibsR} \
--prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
'';
meta = {
platforms = stdenv.lib.platforms.unix;
};
}
''
mkdir $out
echo "# Autogenerated by wrapper-rstudio.nix from R_LIBS_SITE" > $out/$fixLibsR
echo -n ".libPaths(c(.libPaths(), \"" >> $out/$fixLibsR
echo -n $R_LIBS_SITE | sed -e 's/:/", "/g' >> $out/$fixLibsR
echo -n "\"))" >> $out/$fixLibsR
echo >> $out/$fixLibsR
makeWrapper ${rstudio}/bin/rstudio $out/bin/rstudio --set R_PROFILE_USER $out/$fixLibsR \
--prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
''