Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetbrains plugins #191341

Conversation

GenericNerdyUsername
Copy link
Contributor

@GenericNerdyUsername GenericNerdyUsername commented Sep 15, 2022

Description of changes

This commit adds support for declarative plugins (including ones which need patching) and some helper functions for fetching them from https://plugins.jetbrains.com. Untested on darwin. Closes #189183 .

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@rien rien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm have successfully used this PR to add GitHub Copilot to IntelliJ and Clion in my own setup. Thanks!

It is a bit unwieldy to use the functions here though, maybe an interface like this would be more ergonomic:

with pkgs.jetbrains;
let 
  copilot = mkJetbrainsPlugin {
     src = fetchJetbrainsPlugin {
       id = "1234";
       hash = "....";
     };
    buildInputs = with pkgs; [ patchelf gcc-unwrapped  ];
    build = ''
      # ... additional build steps
    '';
  };
in idea-ultimate.withPlugins [ copilot ]

Also, instead of adding exceptions for specialPlugins, we could provide a collection of plugins (pkgs.jetbrains.plugins.copilot for example).

What do you think?

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/clion-github-copilot-fails-to-login/22197/2

@GenericNerdyUsername
Copy link
Contributor Author

How would that interface get the hash of the api response? Would there be a way to make nix ignore impure derivations if its only dependency is content addressed? As long as updating plugins/adding new plugins isn't too hard, I think the plugin list would work.

@ktor
Copy link
Member

ktor commented Oct 7, 2022

Hi @GenericNerdyUsername and @rien, thank you for the PR and copilot code!! I've applied it already with overlay based on:

  1. https://github.com/rien/nixos-config/blob/3c97851e1874c6a05b5d459a858bb1591bf45f54/modules/intellij.nix#L33-L104 and
  2. https://discourse.nixos.org/t/clion-github-copilot-fails-to-login/22197/4?u=ktor

To install GitHub copilot for idea-ultimate and it works like a charm! :)

Here is the overlay: ktor/nixos@35f4071

@rien
Copy link
Contributor

rien commented Oct 13, 2022

How would that interface get the hash of the api response? Would there be a way to make nix ignore impure derivations if its only dependency is content addressed? As long as updating plugins/adding new plugins isn't too hard, I think the plugin list would work.

I think this is usually done by creating an update-script which would generate pure input-url's (+ their hashes) to use with fetchUrl. So the first step (getUrl) would have to be done by that script.

@GenericNerdyUsername GenericNerdyUsername force-pushed the jetbrains-plugins branch 2 times, most recently from ac72005 to 3bc9388 Compare October 18, 2022 17:44
@GenericNerdyUsername
Copy link
Contributor Author

I've added the update script and reworked how you add plugins, though I'm really tired and have definitely missed something, I'm just putting this out there so other people can suggest improvements or use it

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/1402

@GenericNerdyUsername GenericNerdyUsername force-pushed the jetbrains-plugins branch 3 times, most recently from 9b32d54 to adcfa5f Compare November 19, 2022 13:24
@GenericNerdyUsername GenericNerdyUsername force-pushed the jetbrains-plugins branch 3 times, most recently from 446339f to 39bab6e Compare December 6, 2022 14:25
@GenericNerdyUsername
Copy link
Contributor Author

Whats stopping this from getting merged?

@jys1670
Copy link

jys1670 commented Dec 22, 2022

Thank you for your effort! Everything works as expected on my x86_64 laptop.
I've also tried your overlay that adds JCEF support to JDK, it solved markdown preview issues in Clion.
As for slow merges - sadly that's common for complicated changes, to speed things up it is worth messaging few
active reviewers in nixos matrix or mentioning this PR in "PRs ready for review" once again.

@kouyk
Copy link
Contributor

kouyk commented Dec 24, 2022

Whats stopping this from getting merged?

maintainers don't seem to be merging jetbrains related PRs, all of them seems to have been stalled for a while now. furthermore darwin users aren't really reviewing or helping to diagnose build issues

@not-matthias
Copy link

+1 on this. I'd love to not have to use a 3rd party flake to be able to use Github Copilot.

@GenericNerdyUsername GenericNerdyUsername force-pushed the jetbrains-plugins branch 2 times, most recently from 571334c to 27eb514 Compare February 16, 2023 21:03
@GenericNerdyUsername
Copy link
Contributor Author

I made a new version (#223593) which checks for compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jetbrains IDEs with plugins?
7 participants