2020-04-29 01:25:10 +01:00
|
|
|
{ lib, mkDerivation, fetchurl, fetchpatch, fetchFromGitHub, makeDesktopItem, cmake, boost, zlib
|
2019-04-14 19:44:01 +01:00
|
|
|
, openssl, R, qtbase, qtxmlpatterns, qtsensors, qtwebengine, qtwebchannel
|
|
|
|
, libuuid, hunspellDicts, unzip, ant, jdk, gnumake, makeWrapper, pandoc
|
|
|
|
, llvmPackages
|
2017-01-27 23:54:50 +00:00
|
|
|
}:
|
2015-03-23 20:26:13 +00:00
|
|
|
|
2020-02-09 06:44:53 +00:00
|
|
|
with lib;
|
2015-03-23 20:26:13 +00:00
|
|
|
let
|
2018-02-07 17:30:45 +00:00
|
|
|
verMajor = "1";
|
2019-04-14 19:44:01 +01:00
|
|
|
verMinor = "2";
|
2020-04-29 01:25:10 +01:00
|
|
|
verPatch = "5042";
|
2018-02-07 17:30:45 +00:00
|
|
|
version = "${verMajor}.${verMinor}.${verPatch}";
|
2019-04-14 19:44:01 +01:00
|
|
|
ginVer = "2.1.2";
|
|
|
|
gwtVer = "2.8.1";
|
2015-03-23 20:26:13 +00:00
|
|
|
in
|
2020-02-09 06:44:53 +00:00
|
|
|
mkDerivation rec {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "RStudio";
|
|
|
|
inherit version;
|
2015-03-23 20:26:13 +00:00
|
|
|
|
2017-09-26 19:23:10 +01:00
|
|
|
nativeBuildInputs = [ cmake unzip ant jdk makeWrapper pandoc ];
|
|
|
|
|
2019-04-14 19:44:01 +01:00
|
|
|
buildInputs = [ boost zlib openssl R qtbase qtxmlpatterns qtsensors
|
|
|
|
qtwebengine qtwebchannel libuuid ];
|
2015-03-23 20:26:13 +00:00
|
|
|
|
2018-01-15 14:12:55 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rstudio";
|
|
|
|
repo = "rstudio";
|
|
|
|
rev = "v${version}";
|
2020-04-29 01:25:10 +01:00
|
|
|
sha256 = "1n67fa357v51j3z1ma8v2ydfsx3y8n10k2svmfcf4mdzsi8w0kc5";
|
2015-03-23 20:26:13 +00:00
|
|
|
};
|
|
|
|
|
2019-04-14 19:44:01 +01:00
|
|
|
# Hack RStudio to only use the input R and provided libclang.
|
2020-04-29 01:25:10 +01:00
|
|
|
patches = [ ./r-location.patch ./clang-location.patch
|
|
|
|
(fetchpatch {
|
|
|
|
# Fetch a patch to ensure Rstudio compiles against R
|
|
|
|
# 4.0.0, should be removed next 1.2.X Rstudio update
|
|
|
|
# or possibly 1.3.X
|
|
|
|
url = "https://github.com/rstudio/rstudio/commit/3fb2397c2f208bb8ace0bbaf269481ccb96b5b20.patch";
|
|
|
|
sha256 = "0qpgjy6aash0fc0xbns42cwpj3nsw49nkbzwyq8az01xwg81g0f3";
|
|
|
|
})
|
|
|
|
];
|
2019-04-14 19:44:01 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/cpp/core/r_util/REnvironmentPosix.cpp --replace '@R@' ${R}
|
|
|
|
substituteInPlace src/cpp/core/libclang/LibClang.cpp \
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 09:23:57 +01:00
|
|
|
--replace '@libclang@' ${llvmPackages.libclang.lib} \
|
|
|
|
--replace '@libclang.so@' ${llvmPackages.libclang.lib}/lib/libclang.so
|
2019-04-14 19:44:01 +01:00
|
|
|
'';
|
2015-03-23 20:26:13 +00:00
|
|
|
|
|
|
|
ginSrc = fetchurl {
|
|
|
|
url = "https://s3.amazonaws.com/rstudio-buildtools/gin-${ginVer}.zip";
|
2019-04-14 19:44:01 +01:00
|
|
|
sha256 = "16jzmljravpz6p2rxa87k5f7ir8vs7ya75lnfybfajzmci0p13mr";
|
2015-03-23 20:26:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
gwtSrc = fetchurl {
|
|
|
|
url = "https://s3.amazonaws.com/rstudio-buildtools/gwt-${gwtVer}.zip";
|
2019-04-14 19:44:01 +01:00
|
|
|
sha256 = "19x000m3jwnkqgi6ic81lkzyjvvxcfacw2j0vcfcaknvvagzhyhb";
|
2015-03-23 20:26:13 +00:00
|
|
|
};
|
|
|
|
|
2019-09-05 16:31:22 +01:00
|
|
|
hunspellDictionaries = filter isDerivation (unique (attrValues hunspellDicts));
|
|
|
|
# These dicts contain identically-named dict files, so we only keep the
|
|
|
|
# -large versions in case of clashes
|
|
|
|
largeDicts = filter (d: hasInfix "-large-wordlist" d) hunspellDictionaries;
|
|
|
|
otherDicts = filter (d: !(hasAttr "dictFileName" d &&
|
|
|
|
elem d.dictFileName (map (d: d.dictFileName) largeDicts))) hunspellDictionaries;
|
|
|
|
dictionaries = largeDicts ++ otherDicts;
|
2015-03-23 20:26:13 +00:00
|
|
|
|
|
|
|
mathJaxSrc = fetchurl {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "https://s3.amazonaws.com/rstudio-buildtools/mathjax-26.zip";
|
2017-04-30 10:36:42 +01:00
|
|
|
sha256 = "0wbcqb9rbfqqvvhqr1pbqax75wp8ydqdyhp91fbqfqp26xzjv6lk";
|
|
|
|
};
|
|
|
|
|
2019-04-14 19:44:01 +01:00
|
|
|
rsconnectSrc = fetchFromGitHub {
|
|
|
|
owner = "rstudio";
|
|
|
|
repo = "rsconnect";
|
|
|
|
rev = "984745d8";
|
|
|
|
sha256 = "037z0y32k1gdda192y5qn5hi7wp8wyap44mkjlklrgcqkmlcylb9";
|
2015-03-23 20:26:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
preConfigure =
|
|
|
|
''
|
2018-02-07 17:30:45 +00:00
|
|
|
export RSTUDIO_VERSION_MAJOR=${verMajor}
|
|
|
|
export RSTUDIO_VERSION_MINOR=${verMinor}
|
|
|
|
export RSTUDIO_VERSION_PATCH=${verPatch}
|
|
|
|
|
2015-03-23 20:26:13 +00:00
|
|
|
GWT_LIB_DIR=src/gwt/lib
|
|
|
|
|
2018-02-07 17:30:45 +00:00
|
|
|
mkdir -p $GWT_LIB_DIR/gin/${ginVer}
|
|
|
|
unzip ${ginSrc} -d $GWT_LIB_DIR/gin/${ginVer}
|
2015-03-23 20:26:13 +00:00
|
|
|
|
2018-02-07 17:30:45 +00:00
|
|
|
unzip ${gwtSrc}
|
2015-03-23 20:26:13 +00:00
|
|
|
mkdir -p $GWT_LIB_DIR/gwt
|
2018-02-07 17:30:45 +00:00
|
|
|
mv gwt-${gwtVer} $GWT_LIB_DIR/gwt/${gwtVer}
|
2015-03-23 20:26:13 +00:00
|
|
|
|
|
|
|
mkdir dependencies/common/dictionaries
|
2019-09-05 16:31:22 +01:00
|
|
|
for dict in ${builtins.concatStringsSep " " dictionaries}; do
|
2018-02-07 17:30:45 +00:00
|
|
|
for i in "$dict/share/hunspell/"*; do
|
|
|
|
ln -sv $i dependencies/common/dictionaries/
|
|
|
|
done
|
2015-03-23 20:26:13 +00:00
|
|
|
done
|
|
|
|
|
2018-02-07 17:30:45 +00:00
|
|
|
unzip ${mathJaxSrc} -d dependencies/common/mathjax-26
|
2017-04-30 10:36:42 +01:00
|
|
|
|
|
|
|
mkdir -p dependencies/common/pandoc
|
|
|
|
cp ${pandoc}/bin/pandoc dependencies/common/pandoc/
|
2019-04-14 19:44:01 +01:00
|
|
|
|
|
|
|
cp -r ${rsconnectSrc} dependencies/common/rsconnect
|
|
|
|
pushd dependencies/common
|
|
|
|
${R}/bin/R CMD build -d --no-build-vignettes rsconnect
|
|
|
|
popd
|
2015-03-23 20:26:13 +00:00
|
|
|
'';
|
|
|
|
|
2017-08-20 10:35:01 +01:00
|
|
|
cmakeFlags = [ "-DRSTUDIO_TARGET=Desktop" "-DQT_QMAKE_EXECUTABLE=$NIX_QT5_TMP/bin/qmake" ];
|
2015-03-23 20:26:13 +00:00
|
|
|
|
2016-11-22 00:03:16 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
2019-08-13 22:52:01 +01:00
|
|
|
name = "${pname}-${version}";
|
2016-11-22 00:03:16 +00:00
|
|
|
exec = "rstudio %F";
|
|
|
|
icon = "rstudio";
|
|
|
|
desktopName = "RStudio";
|
|
|
|
genericName = "IDE";
|
|
|
|
comment = meta.description;
|
|
|
|
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;";
|
|
|
|
};
|
|
|
|
|
2021-01-24 09:19:10 +00:00
|
|
|
qtWrapperArgs = [ "--suffix PATH : ${gnumake}/bin" ];
|
2020-02-09 06:44:53 +00:00
|
|
|
|
2017-05-01 13:59:43 +01:00
|
|
|
postInstall = ''
|
2016-11-22 00:03:16 +00:00
|
|
|
mkdir $out/share
|
|
|
|
cp -r ${desktopItem}/share/applications $out/share
|
|
|
|
mkdir $out/share/icons
|
|
|
|
ln $out/rstudio.png $out/share/icons
|
2015-10-25 15:18:21 +00:00
|
|
|
'';
|
|
|
|
|
2020-02-09 06:44:53 +00:00
|
|
|
meta = with lib;
|
2015-03-23 20:26:13 +00:00
|
|
|
{ description = "Set of integrated tools for the R language";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.rstudio.com/";
|
2015-03-23 20:26:13 +00:00
|
|
|
license = licenses.agpl3;
|
2017-08-29 12:26:03 +01:00
|
|
|
maintainers = with maintainers; [ ehmry changlinli ciil ];
|
2015-03-23 20:26:13 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|