rstudio-server, rstudioServerWrapper: init at rstudio.version (1.4.1717)

Co-authored-by: Justin Bedo <cu@cua0.org>
Co-authored-by: Jonathan Ringer <jonringer@users.noreply.github.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Benjamin Darwin <bcdarwin@gmail.com>
This commit is contained in:
cfhammill 2020-08-19 21:27:10 -04:00 committed by Justin Bedo
parent d3bc05b0f9
commit fd51177e5c
No known key found for this signature in database
GPG Key ID: 2C18202C56C182BD
3 changed files with 182 additions and 138 deletions

View File

@ -1,4 +1,5 @@
{ lib { lib
, stdenv
, mkDerivation , mkDerivation
, fetchurl , fetchurl
, fetchpatch , fetchpatch
@ -30,6 +31,9 @@
, nodejs , nodejs
, mkYarnModules , mkYarnModules
, qmake , qmake
, server ? false # build server version
, sqlite
, pam
}: }:
let let
@ -65,8 +69,10 @@ let
yarnNix = ./yarndeps.nix; yarnNix = ./yarndeps.nix;
}; };
description = "Set of integrated tools for the R language";
in in
mkDerivation rec { (if server then stdenv.mkDerivation else mkDerivation)
(rec {
inherit pname version src RSTUDIO_VERSION_MAJOR RSTUDIO_VERSION_MINOR RSTUDIO_VERSION_PATCH; inherit pname version src RSTUDIO_VERSION_MAJOR RSTUDIO_VERSION_MINOR RSTUDIO_VERSION_PATCH;
nativeBuildInputs = [ nativeBuildInputs = [
@ -77,6 +83,7 @@ mkDerivation rec {
makeWrapper makeWrapper
pandoc pandoc
nodejs nodejs
] ++ lib.optional (!server) [
copyDesktopItems copyDesktopItems
]; ];
@ -85,26 +92,31 @@ mkDerivation rec {
zlib zlib
openssl openssl
R R
libuuid
libyamlcpp
soci
postgresql
] ++ (if server then [
sqlite.dev
pam
] else [
qtbase qtbase
qtxmlpatterns qtxmlpatterns
qtsensors qtsensors
qtwebengine qtwebengine
qtwebchannel qtwebchannel
libuuid ]);
libyamlcpp
soci
postgresql
];
cmakeFlags = [ cmakeFlags = [
"-DRSTUDIO_TARGET=Desktop" "-DRSTUDIO_TARGET=${if server then "Server" else "Desktop"}"
"-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_BUILD_TYPE=Release"
"-DQT_QMAKE_EXECUTABLE=${qmake}/bin/qmake"
"-DRSTUDIO_USE_SYSTEM_SOCI=ON" "-DRSTUDIO_USE_SYSTEM_SOCI=ON"
"-DRSTUDIO_USE_SYSTEM_BOOST=ON" "-DRSTUDIO_USE_SYSTEM_BOOST=ON"
"-DRSTUDIO_USE_SYSTEM_YAML_CPP=ON" "-DRSTUDIO_USE_SYSTEM_YAML_CPP=ON"
"-DPANDOC_VERSION=${pandoc.version}" "-DPANDOC_VERSION=${pandoc.version}"
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/lib/rstudio" "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/lib/rstudio"
] ++ lib.optional (!server) [
"-DQT_QMAKE_EXECUTABLE=${qmake}/bin/qmake"
]; ];
# Hack RStudio to only use the input R and provided libclang. # Hack RStudio to only use the input R and provided libclang.
@ -168,10 +180,16 @@ mkDerivation rec {
''; '';
postInstall = '' postInstall = ''
mkdir -p $out/share/icons/hicolor/48x48/apps $out/bin mkdir -p $out/bin $out/share
ln $out/lib/rstudio/rstudio.png $out/share/icons/hicolor/48x48/apps
for f in {diagnostics,rpostback,rstudio}; do ${lib.optionalString (!server) ''
mkdir -p $out/share/icons/hicolor/48x48/apps
ln $out/lib/rstudio/rstudio.png $out/share/icons/hicolor/48x48/apps
''}
for f in {${if server
then "crash-handler-proxy,postback,r-ldpath,rpostback,rserver,rserver-pam,rsession,rstudio-server"
else "diagnostics,rpostback,rstudio"}}; do
ln -s $out/lib/rstudio/bin/$f $out/bin ln -s $out/lib/rstudio/bin/$f $out/bin
done done
@ -182,28 +200,30 @@ mkDerivation rec {
rm -r $out/lib/rstudio/bin/{pandoc/pandoc,pandoc} rm -r $out/lib/rstudio/bin/{pandoc/pandoc,pandoc}
''; '';
meta = with lib; {
inherit description;
homepage = "https://www.rstudio.com/";
license = licenses.agpl3Only;
maintainers = with maintainers; [ ciil cfhammill ];
platforms = platforms.linux;
};
passthru = { inherit server; };
} // lib.optionalAttrs (!server) {
qtWrapperArgs = [ qtWrapperArgs = [
"--suffix PATH : ${lib.makeBinPath [ gnumake ]}" "--suffix PATH : ${lib.makeBinPath [ gnumake ]}"
]; ];
desktopItems = [ desktopItems = [
(makeDesktopItem { (makeDesktopItem {
name = "${pname}"; name = pname;
exec = "rstudio %F"; exec = "rstudio %F";
icon = "rstudio"; icon = "rstudio";
desktopName = "RStudio"; desktopName = "RStudio";
genericName = "IDE"; genericName = "IDE";
comment = meta.description; comment = description;
categories = "Development;"; categories = "Development;";
mimeType = "text/x-r-source;text/x-r;text/x-R;text/x-r-doc;text/x-r-sweave;text/x-r-markdown;text/x-r-html;text/x-r-presentation;application/x-r-data;application/x-r-project;text/x-r-history;text/x-r-profile;text/x-tex;text/x-markdown;text/html;text/css;text/javascript;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;"; mimeType = "text/x-r-source;text/x-r;text/x-R;text/x-r-doc;text/x-r-sweave;text/x-r-markdown;text/x-r-html;text/x-r-presentation;application/x-r-data;application/x-r-project;text/x-r-history;text/x-r-profile;text/x-tex;text/x-markdown;text/html;text/css;text/javascript;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;";
}) })
]; ];
})
meta = with lib; {
description = "Set of integrated tools for the R language";
homepage = "https://www.rstudio.com/";
license = licenses.agpl3Only;
maintainers = with maintainers; [ ciil ];
platforms = platforms.linux;
};
}

View File

@ -1,13 +1,20 @@
{ lib, runCommand, R, rstudio, wrapQtAppsHook, recommendedPackages, packages, qtbase }: { lib
, runCommand
, R
, rstudio
, makeWrapper
, wrapQtAppsHook
, recommendedPackages
, packages
, fontconfig
}:
let runCommand (rstudio.name + "-wrapper")
qtVersion = with lib.versions; "${major qtbase.version}.${minor qtbase.version}"; {
in
runCommand (rstudio.name + "-wrapper") {
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;
nativeBuildInputs = [wrapQtAppsHook]; nativeBuildInputs = [ (if rstudio.server then makeWrapper else wrapQtAppsHook) ];
dontWrapQtApps = true; dontWrapQtApps = true;
buildInputs = [ R rstudio ] ++ recommendedPackages ++ packages; buildInputs = [ R rstudio ] ++ recommendedPackages ++ packages;
@ -22,14 +29,27 @@ runCommand (rstudio.name + "-wrapper") {
# uses R_PROFILE_USER to load this code at startup in RStudio. # uses R_PROFILE_USER to load this code at startup in RStudio.
fixLibsR = "fix_libs.R"; fixLibsR = "fix_libs.R";
} }
(
'' ''
mkdir $out mkdir -p $out/bin
ln -s ${rstudio}/share $out ln -s ${rstudio}/share $out
echo "# Autogenerated by wrapper-rstudio.nix from R_LIBS_SITE" > $out/$fixLibsR echo "# Autogenerated by wrapper-rstudio.nix from R_LIBS_SITE" > $out/$fixLibsR
echo -n ".libPaths(c(.libPaths(), \"" >> $out/$fixLibsR echo -n ".libPaths(c(.libPaths(), \"" >> $out/$fixLibsR
echo -n $R_LIBS_SITE | sed -e 's/:/", "/g' >> $out/$fixLibsR echo -n $R_LIBS_SITE | sed -e 's/:/", "/g' >> $out/$fixLibsR
echo -n "\"))" >> $out/$fixLibsR echo -n "\"))" >> $out/$fixLibsR
echo >> $out/$fixLibsR echo >> $out/$fixLibsR
'' +
(if
rstudio.server then ''
makeWrapper ${rstudio}/bin/rsession $out/bin/rsession \
--set R_PROFILE_USER $out/$fixLibsR --set FONTCONFIG_FILE ${fontconfig.out}/etc/fonts/fonts.conf
makeWrapper ${rstudio}/bin/rserver $out/bin/rserver \
--add-flags --rsession-path=$out/bin/rsession
''
else
''
makeQtWrapper ${rstudio}/bin/rstudio $out/bin/rstudio \ makeQtWrapper ${rstudio}/bin/rstudio $out/bin/rstudio \
--set R_PROFILE_USER $out/$fixLibsR --set R_PROFILE_USER $out/$fixLibsR
'' '')
)

View File

@ -20754,6 +20754,8 @@ with pkgs;
packages = []; packages = [];
}; };
rstudioServerWrapper = rstudioWrapper.override { rstudio = rstudio-server; };
rPackages = dontRecurseIntoAttrs (callPackage ../development/r-modules { rPackages = dontRecurseIntoAttrs (callPackage ../development/r-modules {
overrides = (config.rPackageOverrides or (_: {})) pkgs; overrides = (config.rPackageOverrides or (_: {})) pkgs;
}); });
@ -28382,6 +28384,8 @@ with pkgs;
jdk = jdk8; jdk = jdk8;
}; };
rstudio-server = rstudio.override { server = true; };
rsync = callPackage ../applications/networking/sync/rsync (config.rsync or {}); rsync = callPackage ../applications/networking/sync/rsync (config.rsync or {});
rrsync = callPackage ../applications/networking/sync/rsync/rrsync.nix {}; rrsync = callPackage ../applications/networking/sync/rsync/rrsync.nix {};