diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix
index 9bab7e2ce715..9a362fec65be 100644
--- a/pkgs/applications/editors/rstudio/default.nix
+++ b/pkgs/applications/editors/rstudio/default.nix
@@ -128,6 +128,7 @@ in
./clang-location.patch
./use-system-node.patch
./fix-resources-path.patch
+ ./pandoc-nix-path.patch
];
postPatch = ''
@@ -137,14 +138,14 @@ in
--replace 'SOCI_LIBRARY_DIR "/usr/lib"' 'SOCI_LIBRARY_DIR "${soci}/lib"'
substituteInPlace src/gwt/build.xml \
- --replace '/usr/bin/node' '${nodejs}/bin/node'
+ --replace '@node@' ${nodejs}
substituteInPlace src/cpp/core/libclang/LibClang.cpp \
--replace '@libclang@' ${llvmPackages.libclang.lib} \
--replace '@libclang.so@' ${llvmPackages.libclang.lib}/lib/libclang.so
substituteInPlace src/cpp/session/include/session/SessionConstants.hpp \
- --replace "bin/pandoc" "${pandoc}/bin/pandoc"
+ --replace '@pandoc@' ${pandoc}/bin/pandoc
'';
hunspellDictionaries = with lib; filter isDerivation (unique (attrValues hunspellDicts));
diff --git a/pkgs/applications/editors/rstudio/pandoc-nix-path.patch b/pkgs/applications/editors/rstudio/pandoc-nix-path.patch
new file mode 100644
index 000000000000..a2b9bbd9f02b
--- /dev/null
+++ b/pkgs/applications/editors/rstudio/pandoc-nix-path.patch
@@ -0,0 +1,11 @@
+--- a/src/cpp/session/include/session/SessionConstants.hpp
++++ b/src/cpp/session/include/session/SessionConstants.hpp
+@@ -140,7 +140,7 @@
+ #ifdef QUARTO_ENABLED
+ # define kDefaultPandocPath "bin/quarto/bin"
+ #else
+-# define kDefaultPandocPath "bin/pandoc"
++# define kDefaultPandocPath "@pandoc@"
+ #endif
+
+ #define kDefaultQuartoPath "bin/quarto"
diff --git a/pkgs/applications/editors/rstudio/use-system-node.patch b/pkgs/applications/editors/rstudio/use-system-node.patch
index a7e005cd9455..b78adbaee263 100644
--- a/pkgs/applications/editors/rstudio/use-system-node.patch
+++ b/pkgs/applications/editors/rstudio/use-system-node.patch
@@ -21,7 +21,7 @@
- property="node.bin"
- value="/opt/rstudio-tools/dependencies/common/node/${node.version}/bin/node"
- file="/opt/rstudio-tools/dependencies/common/node/${node.version}/bin/node"/>
-+
++