NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.05k stars 14.08k forks source link

Unable to use the GitHub Copilot plugin in Rider #223399

Open jorisvandijk opened 1 year ago

jorisvandijk commented 1 year ago

Describe the bug

I'm unable to use the Copilot plugin in Rider as it won't let me log in and throws the following error:

"Failed to initiate the GitHub login process. Please try again."

Steps To Reproduce

Steps to reproduce the behavior: I am following the steps as provided in the official documentation.

Expected behavior

I would expect it to open a webbrowser and let me connect the GitHub account to Rider.

Screenshots

Screenshot of the error in Rider

Additional context

I can manually connect my GitHub account in the settings in Rider, but that is apparently not enough for the Copilot plugin.

Notify maintainers

@raphaelr

Metadata

 ~ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.8, NixOS, 22.11 (Raccoon), 22.11.3339.da26ae9f6ce`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(joris): `"home-manager-22.11.tar.gz"`
 - channels(root): `"nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Krutonium commented 1 year ago

I worked around this by doing jank stuff. https://gitea.krutonium.ca/Krutonium/NixOS/src/branch/master/user/krutonium-hm-extras/packages.nix#L11-L22

jorisvandijk commented 1 year ago

I worked around this by doing jank stuff. https://gitea.krutonium.ca/Krutonium/NixOS/src/branch/master/user/krutonium-hm-extras/packages.nix#L11-L22

Thank you for the suggestion. I gave it a try, but am not familiar with "jank stuff". I did the following, which did not work:

home.packages = with pkgs; 
    let
      riderScript = pkgs.writeShellScriptBin "rider"
        ''
          ${pkgs.steam-run}/bin/steam-run ${pkgs.jetbrains.rider}/bin/rider
        '';
      rider = pkgs.jetbrains.rider.overrideAttrs (oldAttrs: { meta.priority = 10; });
    in
  [
    steam-run
    jetbrains.rider
    ...
  ];

Any suggestions @Krutonium?

I should add I also tried without the pkgs. in front of each package as I run home.packages = with pkgs;

EDIT: Interestingly, running rider with steam-run rider from terminal did allow me to log in. Unfortunately re-running it without steam-run breaks it again. For now I can manually run it with steam-run, but that's not really a solution to this bug.

Krutonium commented 1 year ago

You need to add rider and riderScript to your packages; and because of the implicit usage, you don't actually need to install steam-run or jetbrains.rider.

Basically what we're doing is replacing the rider that everything normally calls with our own that runs the proper executable through steam-run. (Decreasing the priority of the jetbrains.rider package allows us to overwrite it)

raphaelr commented 1 year ago

The error message is bad, it has nothing to do with logins. The file ~/.local/share/JetBrains/Rider2022.3/github-copilot-intellij/copilot-agent/bin/copilot-agent-linux is pointing to the wrong dynamic linker and needs to be patchelf'd.

$ nix-shell -p
$ patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) copilot-agent-linux

You'll have to repeat this step after every plugin update and ideally after every system update because $NIX_CC can get garbage collected.

Krutonium commented 1 year ago

Would it be possible to nixify the plugins, similar to eg Gnome Addons?

jorisvandijk commented 1 year ago

You'll have to repeat this step after every plugin update and ideally after every system update because $NIX_CC can get garbage collected.

That sounds very annoying to be honest. I'd second the motion of @Krutonium to Nixify :) (Obviously I have no idea how much of a hassle that is, probably way more than I'd imagine)

Thank you for the reply!

jorisvandijk commented 1 year ago

You need to add rider and riderScript to your packages

Yep, that did it! Thanks!

Guekka commented 1 year ago

@Krutonium Have a look at #223593

spy4x commented 8 months ago

Same bug in WebStorm.

vinstonsalim commented 7 months ago

same in phpstorm

stefandango commented 5 months ago

Not sure if something else changed. But after moving to unstable at installing nodejs_22 i can now use copilot in rider.

MSWS commented 3 months ago

Not sure if something else changed. But after moving to unstable at installing nodejs_22 i can now use copilot in rider.

This fixed my issue as well.