From bcdfa1884623c42ed83fe541e5a60b8ee652692c Mon Sep 17 00:00:00 2001 From: nixdrin <146267602+nixdrin@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:29:43 +0200 Subject: [PATCH] jetbrains.rider: use autoPatchelf Turns out Rider was previously relying on having libstdc++ in LD_LIBRARY_PATH, because the binaries were not patched properly. Rewrite the patching to use autoPatchelf similar to CLion so that the RPATH of the binaries are adjusted. While at it also patch all the binaries in the dotCommon and dotTrace plugins. Those seem to need zlib and fontconfig which were completely missing before (they are probably only called when using certain functionality of the IDE). icu doesn't actually seem to be needed (autoPatchelf does not complain that it's missing) and the IDE starts fine without it, so drop it for now. --- .../editors/jetbrains/default.nix | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix index a278a05fe33b..d2a83f07ed56 100644 --- a/pkgs/applications/editors/jetbrains/default.nix +++ b/pkgs/applications/editors/jetbrains/default.nix @@ -7,7 +7,6 @@ , gdb , zlib , python3 -, icu , lldb , dotnet-sdk_7 , maven @@ -17,6 +16,7 @@ , openssl , expat , libxcrypt-legacy +, fontconfig , vmopts ? null }: @@ -252,8 +252,6 @@ let (mkJetBrainsProduct { inherit pname version src wmClass jdk buildNumber; product = "Rider"; - # icu is required by Rider.Backend - extraLdPath = [ icu ]; meta = with lib; { homepage = "https://www.jetbrains.com/rider/"; inherit description license platforms; @@ -268,15 +266,28 @@ let maintainers = with maintainers; [ raphaelr ]; }; }).overrideAttrs (attrs: { - postPatch = lib.optionalString (!stdenv.isDarwin) (attrs.postPatch + '' - interp="$(cat $NIX_CC/nix-support/dynamic-linker)" - patchelf --set-interpreter $interp \ - lib/ReSharperHost/linux-x64/Rider.Backend \ - plugins/dotCommon/DotFiles/linux-x64/JetBrains.Profiler.PdbServer + nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ lib.optionals (stdenv.isLinux) [ + autoPatchelfHook + ]; + buildInputs = (attrs.buildInputs or [ ]) ++ lib.optionals (stdenv.isLinux) [ + stdenv.cc.cc + zlib + fontconfig # plugins/dotTrace/DotFiles/linux-x64/libSkiaSharp.so + ]; + dontAutoPatchelf = true; + postFixup = (attrs.postFixup or "") + lib.optionalString (stdenv.isLinux) '' + ( + cd $out/rider - rm -rf lib/ReSharperHost/linux-x64/dotnet - ln -s ${dotnet-sdk_7} lib/ReSharperHost/linux-x64/dotnet - ''); + # Remove dotnet copy first so it's not considered by autoPatchElf + rm -rf lib/ReSharperHost/linux-x64/dotnet + autoPatchelf \ + lib/ReSharperHost/linux-x64/ \ + plugins/dotCommon/DotFiles/linux-x64/ \ + plugins/dotTrace/DotFiles/linux-x64/ + ln -s ${dotnet-sdk_7} lib/ReSharperHost/linux-x64/dotnet + ) + ''; }); buildRubyMine = { pname, version, src, license, description, wmClass, buildNumber, ... }: