tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
rstudio: do minor cleanup
TomaSajt
8 months ago
77e50143
bc42fc06
+44
-46
1 changed file
expand all
collapse all
unified
split
pkgs
applications
editors
rstudio
default.nix
+44
-46
pkgs/applications/editors/rstudio/default.nix
···
224
'';
225
226
yarnOfflineCache = fetchYarnDeps {
227
-
yarnLock = quartoSrc + "/yarn.lock";
228
hash = "sha256-F+gqVNNhLmyrC+tJuElw7cpx5z/WLHOiYow/y86KR5c=";
229
};
230
···
244
hash = "sha256-ispV6FJdtOELtFNIZDn1lKbwvO/iTO8mrZ8nIOs2uhs=";
245
};
246
247
-
preConfigure = ''
248
-
# populate the directories used by cmake's FetchContent
249
-
mkdir -p build/_deps
250
-
cp -r "$extSrcs"/* build/_deps
251
-
chmod -R u+w build/_deps
0
252
253
-
# set up node_modules directory inside quarto so that panmirror can be built
254
-
mkdir src/gwt/lib/quarto
255
-
cp -r --no-preserve=all ${quartoSrc}/* src/gwt/lib/quarto
256
-
pushd src/gwt/lib/quarto
257
-
yarnConfigHook
258
-
popd
259
260
-
### set up dependencies that will be copied into the result
261
-
# note: only the directory names have to match upstream, the actual versions don't
262
-
# note: symlinks are preserved
263
264
-
mkdir dependencies/dictionaries
265
-
for dict in ${builtins.concatStringsSep " " dictionaries}; do
266
-
for i in "$dict/share/hunspell/"*; do
267
-
ln -s $i dependencies/dictionaries/
0
268
done
269
-
done
270
271
-
ln -s ${quartoWrapper} dependencies/quarto
272
273
-
# version in dependencies/common/install-mathjax
274
-
ln -s ${mathJaxSrc} dependencies/mathjax-27
275
276
-
mkdir -p dependencies/common/node
277
-
# node used by cmake
278
-
# version in cmake/globals.cmake (RSTUDIO_NODE_VERSION)
279
-
ln -s ${nodejs} dependencies/common/node/22.13.1
280
281
-
${lib.optionalString (!server) ''
0
282
pushd $npmRoot
283
284
substituteInPlace package.json \
···
308
# Work around known nan issue for electron_33 and above
309
# https://github.com/nodejs/nan/issues/978
310
substituteInPlace node_modules/nan/nan.h \
311
-
--replace-fail '#include "nan_scriptorigin.h"' ""
312
313
# now that we patched everything, we still have to run the scripts we ignored with --ignore-scripts
314
npm rebuild
315
316
popd
317
-
''}
318
-
'';
319
320
-
postInstall = ''
321
-
mkdir -p $out/bin
322
-
323
-
${lib.optionalString (server && stdenv.hostPlatform.isLinux) ''
0
324
ln -s $out/lib/rstudio/bin/{crash-handler-proxy,postback,r-ldpath,rpostback,rserver,rserver-pam,rsession,rstudio-server} $out/bin
325
-
''}
326
-
327
-
${lib.optionalString (!server && stdenv.hostPlatform.isLinux) ''
328
# remove unneeded electron files, since we'll wrap the app with our own electron
329
shopt -s extglob
330
rm -r $out/lib/rstudio/!(locales|resources|resources.pak)
···
335
--suffix PATH : ${lib.makeBinPath [ gnumake ]}
336
337
ln -s $out/lib/rstudio/resources/app/bin/{diagnostics,rpostback} $out/bin
338
-
''}
339
-
340
-
${lib.optionalString (server && stdenv.hostPlatform.isDarwin) ''
341
ln -s $out/Applications/RStudio.app/Contents/MacOS/{crash-handler-proxy,postback,r-ldpath,rpostback,rserver,rserver-pam,rsession,rstudio-server} $out/bin
342
-
''}
343
-
344
-
${lib.optionalString (!server && stdenv.hostPlatform.isDarwin) ''
345
# electron can't find its files if we use a symlink here
346
makeWrapper $out/Applications/RStudio.app/Contents/MacOS/RStudio $out/bin/rstudio
347
348
ln -s $out/Applications/RStudio.app/Contents/Resources/app/bin/{diagnostics,rpostback} $out/bin
349
-
''}
350
-
'';
351
352
passthru = {
353
inherit server;
···
224
'';
225
226
yarnOfflineCache = fetchYarnDeps {
227
+
src = quartoSrc;
228
hash = "sha256-F+gqVNNhLmyrC+tJuElw7cpx5z/WLHOiYow/y86KR5c=";
229
};
230
···
244
hash = "sha256-ispV6FJdtOELtFNIZDn1lKbwvO/iTO8mrZ8nIOs2uhs=";
245
};
246
247
+
preConfigure =
248
+
''
249
+
# populate the directories used by cmake's FetchContent
250
+
mkdir -p build/_deps
251
+
cp -r "$extSrcs"/* build/_deps
252
+
chmod -R u+w build/_deps
253
254
+
# set up node_modules directory inside quarto so that panmirror can be built
255
+
mkdir src/gwt/lib/quarto
256
+
cp -r --no-preserve=all ${quartoSrc}/* src/gwt/lib/quarto
257
+
pushd src/gwt/lib/quarto
258
+
yarnConfigHook
259
+
popd
260
261
+
### set up dependencies that will be copied into the result
262
+
# note: only the directory names have to match upstream, the actual versions don't
263
+
# note: symlinks are preserved
264
265
+
mkdir dependencies/dictionaries
266
+
for dict in ${builtins.concatStringsSep " " dictionaries}; do
267
+
for i in "$dict/share/hunspell/"*; do
268
+
ln -s $i dependencies/dictionaries/
269
+
done
270
done
0
271
272
+
ln -s ${quartoWrapper} dependencies/quarto
273
274
+
# version in dependencies/common/install-mathjax
275
+
ln -s ${mathJaxSrc} dependencies/mathjax-27
276
277
+
mkdir -p dependencies/common/node
278
+
# node used by cmake
279
+
# version in cmake/globals.cmake (RSTUDIO_NODE_VERSION)
280
+
ln -s ${nodejs} dependencies/common/node/22.13.1
281
282
+
''
283
+
+ lib.optionalString (!server) ''
284
pushd $npmRoot
285
286
substituteInPlace package.json \
···
310
# Work around known nan issue for electron_33 and above
311
# https://github.com/nodejs/nan/issues/978
312
substituteInPlace node_modules/nan/nan.h \
313
+
--replace-fail '#include "nan_scriptorigin.h"' ""
314
315
# now that we patched everything, we still have to run the scripts we ignored with --ignore-scripts
316
npm rebuild
317
318
popd
319
+
'';
0
320
321
+
postInstall =
322
+
''
323
+
mkdir -p $out/bin
324
+
''
325
+
+ lib.optionalString (server && stdenv.hostPlatform.isLinux) ''
326
ln -s $out/lib/rstudio/bin/{crash-handler-proxy,postback,r-ldpath,rpostback,rserver,rserver-pam,rsession,rstudio-server} $out/bin
327
+
''
328
+
+ lib.optionalString (!server && stdenv.hostPlatform.isLinux) ''
0
329
# remove unneeded electron files, since we'll wrap the app with our own electron
330
shopt -s extglob
331
rm -r $out/lib/rstudio/!(locales|resources|resources.pak)
···
336
--suffix PATH : ${lib.makeBinPath [ gnumake ]}
337
338
ln -s $out/lib/rstudio/resources/app/bin/{diagnostics,rpostback} $out/bin
339
+
''
340
+
+ lib.optionalString (server && stdenv.hostPlatform.isDarwin) ''
0
341
ln -s $out/Applications/RStudio.app/Contents/MacOS/{crash-handler-proxy,postback,r-ldpath,rpostback,rserver,rserver-pam,rsession,rstudio-server} $out/bin
342
+
''
343
+
+ lib.optionalString (!server && stdenv.hostPlatform.isDarwin) ''
0
344
# electron can't find its files if we use a symlink here
345
makeWrapper $out/Applications/RStudio.app/Contents/MacOS/RStudio $out/bin/rstudio
346
347
ln -s $out/Applications/RStudio.app/Contents/Resources/app/bin/{diagnostics,rpostback} $out/bin
348
+
'';
0
349
350
passthru = {
351
inherit server;