From 642361effdd7ed3e585bda5f5e3067539835d062 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Thu, 8 May 2025 19:27:54 +0200 Subject: [PATCH 1/5] rstudio{,-server}: 2024.12.1+563 -> 2025.05.0+496 (cherry picked from commit cd6a92d0f09e0f7964e95722f2e4c2dcfd101aa8) --- .../editors/rstudio/boost-1.86.patch | 88 --------- pkgs/applications/editors/rstudio/default.nix | 182 +++++++++++------- .../rstudio/update-nan-and-node-abi.patch | 70 ------- 3 files changed, 117 insertions(+), 223 deletions(-) delete mode 100644 pkgs/applications/editors/rstudio/boost-1.86.patch delete mode 100644 pkgs/applications/editors/rstudio/update-nan-and-node-abi.patch diff --git a/pkgs/applications/editors/rstudio/boost-1.86.patch b/pkgs/applications/editors/rstudio/boost-1.86.patch deleted file mode 100644 index 058eaf42e96d8..0000000000000 --- a/pkgs/applications/editors/rstudio/boost-1.86.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff --git a/src/cpp/core/json/JsonRpc.cpp b/src/cpp/core/json/JsonRpc.cpp -index d034ffe..4b08486 100644 ---- a/src/cpp/core/json/JsonRpc.cpp -+++ b/src/cpp/core/json/JsonRpc.cpp -@@ -193,7 +193,7 @@ void JsonRpcResponse::setAfterResponse( - - bool JsonRpcResponse::hasAfterResponse() const - { -- return afterResponse_; -+ return !afterResponse_.empty(); - } - - -diff --git a/src/cpp/session/modules/rmarkdown/NotebookExec.cpp b/src/cpp/session/modules/rmarkdown/NotebookExec.cpp -index 5631a1f..0e3030b 100644 ---- a/src/cpp/session/modules/rmarkdown/NotebookExec.cpp -+++ b/src/cpp/session/modules/rmarkdown/NotebookExec.cpp -@@ -193,7 +193,7 @@ void ChunkExecContext::connect() - - // leave an execution lock in this folder so it won't be moved if the notebook - // is saved while executing -- auto lock = make_unique( -+ auto lock = rstudio::core::make_unique( - FileLock::createDefault(), - outputPath_.completePath(kExecutionLock)); - locks_.push_back(std::move(lock)); -@@ -204,7 +204,7 @@ void ChunkExecContext::connect() - initializeOutput(); - - // capture conditions -- auto pConditionCapture = make_unique(); -+ auto pConditionCapture = rstudio::core::make_unique(); - pConditionCapture->connect(); - captures_.push_back(std::move(pConditionCapture)); - connections_.push_back(events().onCondition.connect( -@@ -234,7 +234,7 @@ void ChunkExecContext::connect() - boost::bind(&ChunkExecContext::onFileOutput, this, _1, _2, - _3, ChunkOutputPlot, _4))); - -- auto pPlotCapture = make_unique(); -+ auto pPlotCapture = rstudio::core::make_unique(); - if (figWidth > 0 || figHeight > 0) - { - // user specified plot size, use it -@@ -261,7 +261,7 @@ void ChunkExecContext::connect() - boost::bind(&ChunkExecContext::onFileOutput, this, _1, _2, _3, - ChunkOutputHtml, 0))); - -- auto pHtmlCapture = make_unique(); -+ auto pHtmlCapture = rstudio::core::make_unique(); - error = pHtmlCapture->connectHtmlCapture( - outputPath_, - outputPath_.getParent().completePath(kChunkLibDir), -@@ -316,14 +316,14 @@ void ChunkExecContext::connect() - prevCharWidth_ = r::options::getOptionWidth(); - r::options::setOptionWidth(charWidth_); - -- auto pDirCapture = make_unique(); -+ auto pDirCapture = rstudio::core::make_unique(); - error = pDirCapture->connectDir(docId_, workingDir_); - if (error) - LOG_ERROR(error); - captures_.push_back(std::move(pDirCapture)); - - // begin capturing errors -- auto pErrorCapture = make_unique(); -+ auto pErrorCapture = rstudio::core::make_unique(); - pErrorCapture->connect(); - captures_.push_back(std::move(pErrorCapture)); - -@@ -341,7 +341,7 @@ void ChunkExecContext::connect() - boost::bind(&ChunkExecContext::onFileOutput, this, _1, _2, _3, - ChunkOutputData, 0))); - -- auto pDataCapture = make_unique(); -+ auto pDataCapture = rstudio::core::make_unique(); - error = pDataCapture->connectDataCapture( - outputPath_, - options_.mergedOptions()); -@@ -661,7 +661,7 @@ void ChunkExecContext::initializeOutput() - - // leave an execution lock in this folder so it won't be moved if the notebook - // is saved while executing -- auto lock = make_unique( -+ auto lock = rstudio::core::make_unique( - FileLock::createDefault(), - outputPath.completePath(kExecutionLock)); - locks_.push_back(std::move(lock)); diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix index ff70de5898265..8ba7f9df78f54 100644 --- a/pkgs/applications/editors/rstudio/default.nix +++ b/pkgs/applications/editors/rstudio/default.nix @@ -1,47 +1,50 @@ { lib, stdenv, - runCommand, - fetchzip, + + server ? false, # build server version + fetchFromGitHub, + fetchNpmDeps, + fetchYarnDeps, + fetchzip, replaceVars, - cmake, - boost186, - zlib, - openssl, - R, - fontconfig, - quarto, - libuuid, - hunspellDicts, + runCommand, + ant, + cacert, + cmake, + git, jdk, - gnumake, - pandoc, - llvmPackages, - yaml-cpp, - soci, - sqlite, - apple-sdk_11, - xcbuild, + makeWrapper, nodejs, npmHooks, - fetchNpmDeps, + xcbuild, yarn, yarnConfigHook, - fetchYarnDeps, zip, - git, - makeWrapper, + + apple-sdk_11, + boost187, electron_34, - server ? false, # build server version + fontconfig, + gnumake, + hunspellDicts, + libuuid, + llvmPackages, + openssl, pam, + pandoc, + quarto, + R, + soci, + sqlite, + zlib, + nixosTests, }: let - # Note: we shouldn't use the latest electron here, since the node-abi dependency might - # need to be updated every time the latest electron gets a new abi version number electron = electron_34; mathJaxSrc = fetchzip { @@ -53,8 +56,8 @@ let quartoSrc = fetchFromGitHub { owner = "quarto-dev"; repo = "quarto"; - rev = "7d1582d06250216d18696145879415e473a2ae4d"; - hash = "sha256-AaE9EDT3tJieI403QGxAf+A/PEw1rmUdhdpy4WNf40o="; + rev = "8ee12b5d6bd49c7b212eae894bd011ffbeea1c48"; + hash = "sha256-pTrWedYeG2SWQ4jl2fstKjsweWhj4aAvVDiSfkdU3No="; }; hunspellDictionaries = lib.filter lib.isDerivation (lib.unique (lib.attrValues hunspellDicts)); @@ -76,62 +79,106 @@ let in stdenv.mkDerivation rec { pname = "RStudio"; - version = "2024.12.1+563"; - - RSTUDIO_VERSION_MAJOR = lib.versions.major version; - RSTUDIO_VERSION_MINOR = lib.versions.minor version; - RSTUDIO_VERSION_PATCH = lib.versions.patch version; - RSTUDIO_VERSION_SUFFIX = "+" + toString (lib.tail (lib.splitString "+" version)); + version = "2025.05.0+496"; src = fetchFromGitHub { owner = "rstudio"; repo = "rstudio"; tag = "v${version}"; - hash = "sha256-fguomJHs7FBffYfMlgWgnjLWK3uDZYX4Ip4asKZ8XVQ="; + hash = "sha256-yZy/fEYln/jGxErwJiWFgr9w0GvwtMwzpmmHf71chBQ="; + }; + + # sources fetched into _deps via cmake's FetchContent + extSrcs = stdenv.mkDerivation { + name = "${pname}-${version}-ext-srcs"; + inherit src; + + nativeBuildInputs = [ + cacert + cmake + git + ]; + + installPhase = '' + runHook preInstall + + # this will fail, since this is not meant to be a cmake entrypoint + # but it will fetch the dependencies regardless + cmake -S src/cpp/ext -B build || true + + mkdir -p "$out" + cp -r build/_deps/*-src "$out/" + find "$out" -name .git -print0 | xargs -0 rm -rf + + runHook postInstall + ''; + + dontConfigure = true; + dontBuild = true; + dontFixup = true; + + outputHash = "sha256-YW+l0/RZf8ek217pfWTwsR4PTugMGHyW+vaZEwGjMas="; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; }; nativeBuildInputs = [ cmake + git + ant jdk + nodejs yarn yarnConfigHook zip - git ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + xcbuild + ] ++ lib.optionals (!server) [ + makeWrapper (nodejs.python.withPackages (ps: [ ps.setuptools ])) npmHooks.npmConfigHook - makeWrapper ]; buildInputs = [ - boost186 - zlib + boost187 + libuuid openssl R - libuuid - yaml-cpp soci sqlite.dev ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ] - ++ lib.optionals server [ pam ] - ++ lib.optionals (!server) [ fontconfig ]; + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + apple-sdk_11 + ] + ++ lib.optionals (!server) [ + fontconfig + ] + ++ lib.optionals server [ + pam + zlib + ]; cmakeFlags = [ (lib.cmakeFeature "RSTUDIO_TARGET" (if server then "Server" else "Electron")) - (lib.cmakeBool "RSTUDIO_USE_SYSTEM_SOCI" true) + + # don't try fetching the external dependencies already fetched in extSrcs + (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) + (lib.cmakeBool "RSTUDIO_USE_SYSTEM_BOOST" true) - (lib.cmakeBool "RSTUDIO_USE_SYSTEM_YAML_CPP" true) + (lib.cmakeBool "RSTUDIO_USE_SYSTEM_SOCI" true) + (lib.cmakeBool "RSTUDIO_DISABLE_CHECK_FOR_UPDATES" true) (lib.cmakeBool "QUARTO_ENABLED" true) + (lib.cmakeBool "RSTUDIO_ENABLE_COPILOT" false) # copilot-language-server is unfree (lib.cmakeBool "RSTUDIO_CRASHPAD_ENABLED" false) # This is a NOOP except on x86_64-darwin + (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" ( (placeholder "out") + (if stdenv.hostPlatform.isDarwin then "/Applications" else "/lib/rstudio") )) @@ -140,8 +187,17 @@ stdenv.mkDerivation rec { (lib.cmakeBool "RSTUDIO_INSTALL_FREEDESKTOP" stdenv.hostPlatform.isLinux) ]; - # on Darwin, cmake uses find_library to locate R instead of using the PATH - env.NIX_LDFLAGS = "-L${R}/lib/R/lib"; + env = { + ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + + # on Darwin, cmake uses find_library to locate R instead of using the PATH + NIX_LDFLAGS = "-L${R}/lib/R/lib"; + + RSTUDIO_VERSION_MAJOR = lib.versions.major version; + RSTUDIO_VERSION_MINOR = lib.versions.minor version; + RSTUDIO_VERSION_PATCH = lib.versions.patch version; + RSTUDIO_VERSION_SUFFIX = "+" + toString (lib.tail (lib.splitString "+" version)); + }; patches = [ # Hack RStudio to only use the input R and provided libclang. @@ -154,10 +210,7 @@ stdenv.mkDerivation rec { ./ignore-etc-os-release.patch ./dont-yarn-install.patch - ./boost-1.86.patch ./fix-darwin.patch - # needed for rebuilding for later electron versions - ./update-nan-and-node-abi.patch ]; postPatch = '' @@ -172,7 +225,7 @@ stdenv.mkDerivation rec { yarnOfflineCache = fetchYarnDeps { yarnLock = quartoSrc + "/yarn.lock"; - hash = "sha256-48Q2MkfzXZSL3ly56WSjRVwU3fgRD8xivQobStBkk6Y="; + hash = "sha256-F+gqVNNhLmyrC+tJuElw7cpx5z/WLHOiYow/y86KR5c="; }; dontYarnInstallDeps = true; # will call manually in preConfigure @@ -187,14 +240,16 @@ stdenv.mkDerivation rec { npmDeps = fetchNpmDeps { name = "rstudio-${version}-npm-deps"; inherit src; - patches = [ ./update-nan-and-node-abi.patch ]; postPatch = "cd ${npmRoot}"; - hash = "sha256-9VHse+nxr5A1EWuszQ6cnJAMqYiHFqHQ4OJ/TJq+XoI="; + hash = "sha256-ispV6FJdtOELtFNIZDn1lKbwvO/iTO8mrZ8nIOs2uhs="; }; - env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; - preConfigure = '' + # populate the directories used by cmake's FetchContent + mkdir -p build/_deps + cp -r "$extSrcs"/* build/_deps + chmod -R u+w build/_deps + # set up node_modules directory inside quarto so that panmirror can be built mkdir src/gwt/lib/quarto cp -r --no-preserve=all ${quartoSrc}/* src/gwt/lib/quarto @@ -221,12 +276,7 @@ stdenv.mkDerivation rec { mkdir -p dependencies/common/node # node used by cmake # version in cmake/globals.cmake (RSTUDIO_NODE_VERSION) - ln -s ${nodejs} dependencies/common/node/20.15.1 - - # node used at runtime - # version in cmake/globals.cmake (RSTUDIO_INSTALLED_NODE_VERSION) - # upstream uses the -patched suffix for the runtime node directory - ln -s ${nodejs} dependencies/common/node/20.15.1-patched + ln -s ${nodejs} dependencies/common/node/22.13.1 ${lib.optionalString (!server) '' pushd $npmRoot @@ -301,12 +351,13 @@ stdenv.mkDerivation rec { passthru = { inherit server; - tests = { + tests = lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit (nixosTests) rstudio-server; }; }; meta = { + changelog = "https://github.com/rstudio/rstudio/tree/${src.rev}/version/news"; description = "Set of integrated tools for the R language"; homepage = "https://www.rstudio.com/"; license = lib.licenses.agpl3Only; @@ -316,6 +367,7 @@ stdenv.mkDerivation rec { tomasajt ]; mainProgram = "rstudio" + lib.optionalString server "-server"; - platforms = lib.platforms.linux ++ lib.platforms.darwin; + # rstudio-server on darwin is only partially supported by upstream + platforms = lib.platforms.linux ++ lib.optionals (!server) lib.platforms.darwin; }; } diff --git a/pkgs/applications/editors/rstudio/update-nan-and-node-abi.patch b/pkgs/applications/editors/rstudio/update-nan-and-node-abi.patch deleted file mode 100644 index bdb62dfa8a5ed..0000000000000 --- a/pkgs/applications/editors/rstudio/update-nan-and-node-abi.patch +++ /dev/null @@ -1,70 +0,0 @@ -diff --git a/src/node/desktop/package-lock.json b/src/node/desktop/package-lock.json -index a210521..9543abb 100644 ---- a/src/node/desktop/package-lock.json -+++ b/src/node/desktop/package-lock.json -@@ -18,7 +18,7 @@ - "line-reader": "0.4.0", - "lodash.debounce": "4.0.8", - "net-ipc": "2.2.0", -- "node-abi": "3.71.0", -+ "node-abi": "^3.74.0", - "node-addon-api": "8.3.0", - "node-system-fonts": "1.0.1", - "properties-reader": "2.3.0", -@@ -56,7 +56,7 @@ - "json-schema-to-typescript": "14.1.0", - "lint-staged": "15.2.10", - "mocha": "10.8.2", -- "nan": "2.22.0", -+ "nan": "^2.22.1", - "node-loader": "2.1.0", - "nyc": "17.1.0", - "prettier": "3.3.3", -@@ -9538,9 +9538,9 @@ - } - }, - "node_modules/nan": { -- "version": "2.22.0", -- "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz", -- "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==", -+ "version": "2.22.1", -+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.1.tgz", -+ "integrity": "sha512-pfRR4ZcNTSm2ZFHaztuvbICf+hyiG6ecA06SfAxoPmuHjvMu0KUIae7Y8GyVkbBqeEIidsmXeYooWIX9+qjfRQ==", - "license": "MIT" - }, - "node_modules/nanoid": { -@@ -9667,9 +9667,9 @@ - } - }, - "node_modules/node-abi": { -- "version": "3.71.0", -- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.71.0.tgz", -- "integrity": "sha512-SZ40vRiy/+wRTf21hxkkEjPJZpARzUMVcJoQse2EF8qkUWbbO2z7vd5oA/H6bVH6SZQ5STGcu0KRDS7biNRfxw==", -+ "version": "3.74.0", -+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.74.0.tgz", -+ "integrity": "sha512-c5XK0MjkGBrQPGYG24GBADZud0NCbznxNx0ZkS+ebUTrmV1qTDxPxSL8zEAPURXSbLRWVexxmP4986BziahL5w==", - "license": "MIT", - "dependencies": { - "semver": "^7.3.5" -diff --git a/src/node/desktop/package.json b/src/node/desktop/package.json -index 8b8ef47..287d879 100644 ---- a/src/node/desktop/package.json -+++ b/src/node/desktop/package.json -@@ -54,7 +54,7 @@ - "json-schema-to-typescript": "14.1.0", - "lint-staged": "15.2.10", - "mocha": "10.8.2", -- "nan": "2.22.0", -+ "nan": "^2.22.1", - "node-loader": "2.1.0", - "nyc": "17.1.0", - "prettier": "3.3.3", -@@ -76,7 +76,7 @@ - "line-reader": "0.4.0", - "lodash.debounce": "4.0.8", - "net-ipc": "2.2.0", -- "node-abi": "3.71.0", -+ "node-abi": "^3.74.0", - "node-addon-api": "8.3.0", - "node-system-fonts": "1.0.1", - "properties-reader": "2.3.0", From a2da6fda27d4e80e8fa0eb6185b0da0a11301940 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sat, 7 Jun 2025 18:17:19 +0200 Subject: [PATCH 2/5] rstudio: 2025.05.0+496 -> 2025.05.1+513, unlock jdk version (cherry picked from commit bc42fc0684e568768575a095894b2954da845c6a) --- pkgs/applications/editors/rstudio/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix index 8ba7f9df78f54..89fb17197e4a3 100644 --- a/pkgs/applications/editors/rstudio/default.nix +++ b/pkgs/applications/editors/rstudio/default.nix @@ -79,13 +79,13 @@ let in stdenv.mkDerivation rec { pname = "RStudio"; - version = "2025.05.0+496"; + version = "2025.05.1+513"; src = fetchFromGitHub { owner = "rstudio"; repo = "rstudio"; tag = "v${version}"; - hash = "sha256-yZy/fEYln/jGxErwJiWFgr9w0GvwtMwzpmmHf71chBQ="; + hash = "sha256-KaolU82bxzAlYl+aYwlFljqsmNv0dn8XP1llaLK3LQE="; }; # sources fetched into _deps via cmake's FetchContent diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 04ab45ad4fdf7..a1f6229d537ef 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13960,9 +13960,7 @@ with pkgs; backend = "wayland"; }; - rstudio = callPackage ../applications/editors/rstudio { - jdk = jdk8; - }; + rstudio = callPackage ../applications/editors/rstudio { }; rstudio-server = rstudio.override { server = true; }; From 028c00e72872f77581da097597352e98c3dd230a Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sat, 7 Jun 2025 18:26:52 +0200 Subject: [PATCH 3/5] rstudio: do minor cleanup (cherry picked from commit 77e50143bbbbc3bdbd4dc2197f563fe59a7f92e5) --- pkgs/applications/editors/rstudio/default.nix | 96 +++++++++---------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix index 89fb17197e4a3..758428d1f05af 100644 --- a/pkgs/applications/editors/rstudio/default.nix +++ b/pkgs/applications/editors/rstudio/default.nix @@ -224,7 +224,7 @@ stdenv.mkDerivation rec { ''; yarnOfflineCache = fetchYarnDeps { - yarnLock = quartoSrc + "/yarn.lock"; + src = quartoSrc; hash = "sha256-F+gqVNNhLmyrC+tJuElw7cpx5z/WLHOiYow/y86KR5c="; }; @@ -244,41 +244,43 @@ stdenv.mkDerivation rec { hash = "sha256-ispV6FJdtOELtFNIZDn1lKbwvO/iTO8mrZ8nIOs2uhs="; }; - preConfigure = '' - # populate the directories used by cmake's FetchContent - mkdir -p build/_deps - cp -r "$extSrcs"/* build/_deps - chmod -R u+w build/_deps - - # set up node_modules directory inside quarto so that panmirror can be built - mkdir src/gwt/lib/quarto - cp -r --no-preserve=all ${quartoSrc}/* src/gwt/lib/quarto - pushd src/gwt/lib/quarto - yarnConfigHook - popd - - ### set up dependencies that will be copied into the result - # note: only the directory names have to match upstream, the actual versions don't - # note: symlinks are preserved - - mkdir dependencies/dictionaries - for dict in ${builtins.concatStringsSep " " dictionaries}; do - for i in "$dict/share/hunspell/"*; do - ln -s $i dependencies/dictionaries/ + preConfigure = + '' + # populate the directories used by cmake's FetchContent + mkdir -p build/_deps + cp -r "$extSrcs"/* build/_deps + chmod -R u+w build/_deps + + # set up node_modules directory inside quarto so that panmirror can be built + mkdir src/gwt/lib/quarto + cp -r --no-preserve=all ${quartoSrc}/* src/gwt/lib/quarto + pushd src/gwt/lib/quarto + yarnConfigHook + popd + + ### set up dependencies that will be copied into the result + # note: only the directory names have to match upstream, the actual versions don't + # note: symlinks are preserved + + mkdir dependencies/dictionaries + for dict in ${builtins.concatStringsSep " " dictionaries}; do + for i in "$dict/share/hunspell/"*; do + ln -s $i dependencies/dictionaries/ + done done - done - ln -s ${quartoWrapper} dependencies/quarto + ln -s ${quartoWrapper} dependencies/quarto - # version in dependencies/common/install-mathjax - ln -s ${mathJaxSrc} dependencies/mathjax-27 + # version in dependencies/common/install-mathjax + ln -s ${mathJaxSrc} dependencies/mathjax-27 - mkdir -p dependencies/common/node - # node used by cmake - # version in cmake/globals.cmake (RSTUDIO_NODE_VERSION) - ln -s ${nodejs} dependencies/common/node/22.13.1 + mkdir -p dependencies/common/node + # node used by cmake + # version in cmake/globals.cmake (RSTUDIO_NODE_VERSION) + ln -s ${nodejs} dependencies/common/node/22.13.1 - ${lib.optionalString (!server) '' + '' + + lib.optionalString (!server) '' pushd $npmRoot substituteInPlace package.json \ @@ -308,23 +310,22 @@ stdenv.mkDerivation rec { # Work around known nan issue for electron_33 and above # https://github.com/nodejs/nan/issues/978 substituteInPlace node_modules/nan/nan.h \ - --replace-fail '#include "nan_scriptorigin.h"' "" + --replace-fail '#include "nan_scriptorigin.h"' "" # now that we patched everything, we still have to run the scripts we ignored with --ignore-scripts npm rebuild popd - ''} - ''; - - postInstall = '' - mkdir -p $out/bin + ''; - ${lib.optionalString (server && stdenv.hostPlatform.isLinux) '' + postInstall = + '' + mkdir -p $out/bin + '' + + lib.optionalString (server && stdenv.hostPlatform.isLinux) '' ln -s $out/lib/rstudio/bin/{crash-handler-proxy,postback,r-ldpath,rpostback,rserver,rserver-pam,rsession,rstudio-server} $out/bin - ''} - - ${lib.optionalString (!server && stdenv.hostPlatform.isLinux) '' + '' + + lib.optionalString (!server && stdenv.hostPlatform.isLinux) '' # remove unneeded electron files, since we'll wrap the app with our own electron shopt -s extglob rm -r $out/lib/rstudio/!(locales|resources|resources.pak) @@ -335,19 +336,16 @@ stdenv.mkDerivation rec { --suffix PATH : ${lib.makeBinPath [ gnumake ]} ln -s $out/lib/rstudio/resources/app/bin/{diagnostics,rpostback} $out/bin - ''} - - ${lib.optionalString (server && stdenv.hostPlatform.isDarwin) '' + '' + + lib.optionalString (server && stdenv.hostPlatform.isDarwin) '' ln -s $out/Applications/RStudio.app/Contents/MacOS/{crash-handler-proxy,postback,r-ldpath,rpostback,rserver,rserver-pam,rsession,rstudio-server} $out/bin - ''} - - ${lib.optionalString (!server && stdenv.hostPlatform.isDarwin) '' + '' + + lib.optionalString (!server && stdenv.hostPlatform.isDarwin) '' # electron can't find its files if we use a symlink here makeWrapper $out/Applications/RStudio.app/Contents/MacOS/RStudio $out/bin/rstudio ln -s $out/Applications/RStudio.app/Contents/Resources/app/bin/{diagnostics,rpostback} $out/bin - ''} - ''; + ''; passthru = { inherit server; From 818cdc906f0c976176c1607b36d1c4a90335f664 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sat, 7 Jun 2025 19:05:48 +0200 Subject: [PATCH 4/5] rstudio: move to pkgs/by-name (cherry picked from commit c700de3abb18a4d348eeec207e23aa403472ae1b) --- .../editors => by-name/rs}/rstudio/clang-location.patch | 0 .../editors => by-name/rs}/rstudio/dont-yarn-install.patch | 0 .../editors => by-name/rs}/rstudio/fix-darwin.patch | 0 .../editors => by-name/rs}/rstudio/ignore-etc-os-release.patch | 0 .../rstudio/default.nix => by-name/rs/rstudio/package.nix} | 0 .../editors => by-name/rs}/rstudio/r-location.patch | 0 pkgs/top-level/all-packages.nix | 2 -- 7 files changed, 2 deletions(-) rename pkgs/{applications/editors => by-name/rs}/rstudio/clang-location.patch (100%) rename pkgs/{applications/editors => by-name/rs}/rstudio/dont-yarn-install.patch (100%) rename pkgs/{applications/editors => by-name/rs}/rstudio/fix-darwin.patch (100%) rename pkgs/{applications/editors => by-name/rs}/rstudio/ignore-etc-os-release.patch (100%) rename pkgs/{applications/editors/rstudio/default.nix => by-name/rs/rstudio/package.nix} (100%) rename pkgs/{applications/editors => by-name/rs}/rstudio/r-location.patch (100%) diff --git a/pkgs/applications/editors/rstudio/clang-location.patch b/pkgs/by-name/rs/rstudio/clang-location.patch similarity index 100% rename from pkgs/applications/editors/rstudio/clang-location.patch rename to pkgs/by-name/rs/rstudio/clang-location.patch diff --git a/pkgs/applications/editors/rstudio/dont-yarn-install.patch b/pkgs/by-name/rs/rstudio/dont-yarn-install.patch similarity index 100% rename from pkgs/applications/editors/rstudio/dont-yarn-install.patch rename to pkgs/by-name/rs/rstudio/dont-yarn-install.patch diff --git a/pkgs/applications/editors/rstudio/fix-darwin.patch b/pkgs/by-name/rs/rstudio/fix-darwin.patch similarity index 100% rename from pkgs/applications/editors/rstudio/fix-darwin.patch rename to pkgs/by-name/rs/rstudio/fix-darwin.patch diff --git a/pkgs/applications/editors/rstudio/ignore-etc-os-release.patch b/pkgs/by-name/rs/rstudio/ignore-etc-os-release.patch similarity index 100% rename from pkgs/applications/editors/rstudio/ignore-etc-os-release.patch rename to pkgs/by-name/rs/rstudio/ignore-etc-os-release.patch diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/by-name/rs/rstudio/package.nix similarity index 100% rename from pkgs/applications/editors/rstudio/default.nix rename to pkgs/by-name/rs/rstudio/package.nix diff --git a/pkgs/applications/editors/rstudio/r-location.patch b/pkgs/by-name/rs/rstudio/r-location.patch similarity index 100% rename from pkgs/applications/editors/rstudio/r-location.patch rename to pkgs/by-name/rs/rstudio/r-location.patch diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a1f6229d537ef..d5607105a6223 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13960,8 +13960,6 @@ with pkgs; backend = "wayland"; }; - rstudio = callPackage ../applications/editors/rstudio { }; - rstudio-server = rstudio.override { server = true; }; rsync = callPackage ../applications/networking/sync/rsync (config.rsync or { }); From c34a8ea19a064d6dcf161637cacffb4b609bc283 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Wed, 25 Jun 2025 17:05:10 +0200 Subject: [PATCH 5/5] rstudio: bump electron version (cherry picked from commit a2a5367191218126e63cbda85bbb203d192155af) --- pkgs/by-name/rs/rstudio/bump-node-abi.patch | 67 +++++++++++++++++++++ pkgs/by-name/rs/rstudio/package.nix | 11 +++- 2 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 pkgs/by-name/rs/rstudio/bump-node-abi.patch diff --git a/pkgs/by-name/rs/rstudio/bump-node-abi.patch b/pkgs/by-name/rs/rstudio/bump-node-abi.patch new file mode 100644 index 0000000000000..10d3c424f25dd --- /dev/null +++ b/pkgs/by-name/rs/rstudio/bump-node-abi.patch @@ -0,0 +1,67 @@ +diff --git a/src/node/desktop/package-lock.json b/src/node/desktop/package-lock.json +index e4cf455..f822c46 100644 +--- a/src/node/desktop/package-lock.json ++++ b/src/node/desktop/package-lock.json +@@ -18,7 +18,7 @@ + "line-reader": "0.4.0", + "lodash.debounce": "4.0.8", + "net-ipc": "2.2.0", +- "node-abi": "3.71.0", ++ "node-abi": "^4.10.0", + "node-addon-api": "8.3.1", + "node-system-fonts": "1.0.1", + "properties-reader": "2.3.0", +@@ -1068,6 +1068,19 @@ + "node": ">=12.13.0" + } + }, ++ "node_modules/@electron/rebuild/node_modules/node-abi": { ++ "version": "3.75.0", ++ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.75.0.tgz", ++ "integrity": "sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "semver": "^7.3.5" ++ }, ++ "engines": { ++ "node": ">=10" ++ } ++ }, + "node_modules/@electron/universal": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-2.0.2.tgz", +@@ -9615,15 +9628,15 @@ + } + }, + "node_modules/node-abi": { +- "version": "3.71.0", +- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.71.0.tgz", +- "integrity": "sha512-SZ40vRiy/+wRTf21hxkkEjPJZpARzUMVcJoQse2EF8qkUWbbO2z7vd5oA/H6bVH6SZQ5STGcu0KRDS7biNRfxw==", ++ "version": "4.10.0", ++ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-4.10.0.tgz", ++ "integrity": "sha512-99+BHGmmk969uU3Q4DM9t2tBvDKmqZ3prz/yumY7n+fV2zA+DAOBXuodsp9ZD/QSXK8aSKgWIpkg8tbrAe9JBg==", + "license": "MIT", + "dependencies": { +- "semver": "^7.3.5" ++ "semver": "^7.6.3" + }, + "engines": { +- "node": ">=10" ++ "node": ">=22.12.0" + } + }, + "node_modules/node-abort-controller": { +diff --git a/src/node/desktop/package.json b/src/node/desktop/package.json +index 1fe9294..e3797cf 100644 +--- a/src/node/desktop/package.json ++++ b/src/node/desktop/package.json +@@ -76,7 +76,7 @@ + "line-reader": "0.4.0", + "lodash.debounce": "4.0.8", + "net-ipc": "2.2.0", +- "node-abi": "3.71.0", ++ "node-abi": "^4.10.0", + "node-addon-api": "8.3.1", + "node-system-fonts": "1.0.1", + "properties-reader": "2.3.0", diff --git a/pkgs/by-name/rs/rstudio/package.nix b/pkgs/by-name/rs/rstudio/package.nix index 758428d1f05af..f20943963c5a8 100644 --- a/pkgs/by-name/rs/rstudio/package.nix +++ b/pkgs/by-name/rs/rstudio/package.nix @@ -26,7 +26,7 @@ apple-sdk_11, boost187, - electron_34, + electron_36, fontconfig, gnumake, hunspellDicts, @@ -45,7 +45,7 @@ }: let - electron = electron_34; + electron = electron_36; mathJaxSrc = fetchzip { url = "https://s3.amazonaws.com/rstudio-buildtools/mathjax-27.zip"; @@ -211,6 +211,7 @@ stdenv.mkDerivation rec { ./ignore-etc-os-release.patch ./dont-yarn-install.patch ./fix-darwin.patch + ./bump-node-abi.patch ]; postPatch = '' @@ -241,7 +242,11 @@ stdenv.mkDerivation rec { name = "rstudio-${version}-npm-deps"; inherit src; postPatch = "cd ${npmRoot}"; - hash = "sha256-ispV6FJdtOELtFNIZDn1lKbwvO/iTO8mrZ8nIOs2uhs="; + patches = [ + # needed for support for electron versions above electron_34 + ./bump-node-abi.patch + ]; + hash = "sha256-64PJPUE/xwdQdxVGiKzy8ADnxXH/qGQtFMib0unZpoA="; }; preConfigure =