NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.32k stars 14.29k forks source link

Jetbrains Rider 2024.3 can not resolve the dotnet sdk #358171

Open archevel opened 3 days ago

archevel commented 3 days ago

Describe the bug

Jetbrains Rider 2024.3 can not resolve the dotnet sdk on startup. This seems to be caused by the post install script of the package linking in the wrapped sdk and not the actual sdk location.

Steps To Reproduce

Add pkgs.jetbrains.rider to system packages. Start rider and try to create or open a solution

Expected behavior

The solution opens and can be compiled and worked with.

Screenshots

Additional context

Starting rider one of the first error messages shows that rider seems to be unable to resolve the dotnet sdk properly.

2024-11-22 16:25:15,605 [    181] SEVERE - #c.j.r.p.ProtocolManager - java.io.FileNotFoundException: No 'linux-x64/dotnet/dotnet' found in locations: '%RESHARPER_HOST_BIN%'(null), '/nix/store/3iajv66mqlni62mpi03z9gr3rqfndv02-rider-2024.3/rider/lib/ReSharperHost'
java.util.concurrent.ExecutionException: java.io.FileNotFoundException: No 'linux-x64/dotnet/dotnet' found in locations: '%RESHARPER_HOST_BIN%'(null), '/nix/store/3iajv66mqlni62mpi03z9gr3rqfndv02-rider-2024.3/rider/lib/ReSharperHost'

Poking around in the filesystem a bit I could see that:

lrwxrwxrwx 1 root root 70  1 jan  1970 /nix/store/3iajv66mqlni62mpi03z9gr3rqfndv02-rider-2024.3/rider/lib/ReSharperHost/linux-x64/dotnet -> /nix/store/nbinppwwjq33wfz79xg157zxl3pbd831-dotnet-sdk-wrapped-7.0.410

which indicates that resharper is pointed to the nix wrapper for the sdk which does not resolve to the actual location of the sdk.

$ ls -la /nix/store/3iajv66mqlni62mpi03z9gr3rqfndv02-rider-2024.3/rider/lib/ReSharperHost/linux-x64/dotnet/bin/dotnet
lrwxrwxrwx 1 root root 73  1 jan  1970 /nix/store/3iajv66mqlni62mpi03z9gr3rqfndv02-rider-2024.3/rider/lib/ReSharperHost/linux-x64/dotnet/bin/dotnet -> /nix/store/kmafnn0290xfll76rrzxba9abys23578-dotnet-sdk-7.0.410/bin/dotnet

show the location of the unwrapped sdk so rider needs linux-x64/dotnet/dotnet in rider/lib/ReSharperHost to actually point to the unwrapped sdk locations share/dotnet folder.

I managed to make it work with the below modification to my configuration file:

    (jetbrains.rider.overrideAttrs (attrs: {
      postInstall = (attrs.postInstall or "") + lib.optionalString (stdenv.hostPlatform.isLinux) ''
        (
          cd $out/rider

          ls -d $PWD/plugins/cidr-debugger-plugin/bin/lldb/linux/*/lib/python3.8/lib-dynload/* |
          xargs patchelf \
            --replace-needed libssl.so.10 libssl.so \
            --replace-needed libcrypto.so.10 libcrypto.so \
            --replace-needed libcrypt.so.1 libcrypt.so

          for dir in lib/ReSharperHost/linux-*; do
            rm -rf $dir/dotnet
            ln -s ${dotnet-sdk_7.unwrapped}/share/dotnet $dir/dotnet 
          done
        )
      '';
    }))

So the difference is on this line in the jetbrains/default.nix file. Essentially I've just used the unwrapped location of the sdk. However, very unsure if this is the desired setup or if the wrapper should be fixed so it can support other tools :shrug:

Metadata

Notify maintainers

@raphaelr You are mentioned as the maintainer of the jetbrains.rider package.

Many thanks!


Note for maintainers: Please tag this issue in your PR.


Add a :+1: reaction to issues you find important.

archevel commented 3 days ago

Made a PR:#358178 with a fix, but since I'm not overly familiar with nix I'm not sure how to test it properly :)