Add support for plugins patching and add nixpkgs patches#173
Add support for plugins patching and add nixpkgs patches#173SamueleFacenda wants to merge 12 commits intonix-community:mainfrom
Conversation
|
How do you intend to handle differences between plugin/ide versions? E.g. if you have an override for (say) Also, does @theCapypara actually want to maintain per-plugin overrides in this flake, or would it be better to document how end-users can override plugin derivations themselves and/or link to a separate repo with overrides you wish to maintain? If we do end up with overrides maintained here, and they are only maintained against recent plugin/ide versions, perhaps they should be made optional and not be automatically applied? |
|
Thanks! I am not against adding "special plugins", but I'm also not willing to maintain them :). (Unless I ever run across a plugin I need that needs it.) So, a few thoughts so I can accept this:
Does that mean you haven't tested them yet? You can find the plugin IDs that this flake uses on the bottom of the plugin marketplace pages: https://plugins.jetbrains.com/plugin/25044-stonecutter-dev -> "Plugin ID" |
Thanks, I missed that, I tried grepping the plugin source but found nothing. I will think about the best way to implement the rest, I will put myself as a maintainer for the plugins I use. Also, most of the overrides right now are just for running |
This sounds like something that could be applied across all plugins without needing plugin-specific overrides? |
|
I agree, if there are some generally applicable things we can just do them to all plugins, always. We just need to be careful with the single-jar file plugins, not sure how I think as for how to implement per-plugin overrides, it could be useful for you to wait for #172 to be done. It might be useful to wait for {
plugin-id = {
src = plugin-drv; # The unmodified plugin
override = special-plugin; # The content of special-plugins.nix for this plugin ID or null.
};
plugin2-id = ...;
}
Examples (pseudo code): # Simple like before
buildIdeWithPlugins pkgs "idea" [ "IdeaVIM" ]# Long form
buildIdeWithPlugins pkgs "idea" (pluginsForIde "idea" [ "IdeaVIM" ])# Disabling overrides
let
plugins = lib.recursiveUpdate (pluginsForIde "idea" [ "IdeaVIM" ]) { IdeaVIM = { override = null; }; };
in
buildIdeWithPlugins pkgs "idea" pluginsOr something similar to that :) If you both think that could be a good approach we could merge #172 into an intermediate branch instead of |
I like the proposed direction, but I think we should avoid If it returns a simple list or a flat attrset, then it is easy for end-users to integrate with other tooling (such as I suspect we could still achieve the goal by introducing an "overridePlugins" function which As for making this configurable, I wonder if that is best achieved by either: exposing these functions to end users, so they can run them themselves and inject logic in-between; or by adding E.g., buildPluginsForIdeWith
{
applyPluginOverrides = false;
}
pkgs
"idea"
[ ];buildPluginsForIdeWith
{
dontOverride = [ "IdeaVIM" ];
extraOverrides = {
"com.intellij.plugins.watcher" = plugin: plugin.overrideAttrs (
finalAttrs: prevAttrs: {
# ...
}
);
};
}
pkgs
"idea"
[ ];Not sure this is the perfect solution, just throwing ideas out there. 😁 |
|
I like the |
|
Ok, I'll update the code soon. I'll try to integrate some version handling to default overrides, from my experience with the github copilot override it make sense to have different overrides for different versions, but it would add a lot of complexity. Maybe it's better to keep only one override per plugin and let the users apply their own overrides for older versions, what do you think? |
2bedfb8 to
a779b31
Compare
|
@SamueleFacenda I'll mark this as a draft while still in progress, please undraft when ready to review, and let me know if I can help in any way :) |
|
Ok. Sorry, I'm very busy with university exams in this period. |
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
a694dde to
fdc4de7
Compare
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
…th the existing pluginsForIde function, fix warnings Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
fdc4de7 to
b97378d
Compare
|
@theCapypara the PR is almost ready. But with the latest nixpkgs update I found out that the copilot patch doesn't always work (e.g. works for clion 2025.3.2 but not for clion 2025.3.1.1, same plugin version), so I tried different approaches. |
|
Hm, I'm sorry but I can't help much with that. Plugins can't alter the PATH afaik, you need to patch how the plugin searches for the binary and provide a store path (probably). I also don't understand why Microsoft feels the need to shove NodeJS into everything. |
MattSturgeon
left a comment
There was a problem hiding this comment.
I had a quick look over the diff. Didn't look too closely.
| pname = name; | ||
| inherit version src; | ||
| nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook; | ||
| buildInputs = [ (lib.getLib stdenv.cc.cc) ]; |
There was a problem hiding this comment.
This looks redundant. We're using stdenv already, not stdenvNoCC. Isn't libc available by default?
There was a problem hiding this comment.
I'm checking, this was included in the nixpkgs patches.
There was a problem hiding this comment.
It's actually needed, without it plugins like PythonCore fails to build because the autoPatcheldHook cannot find that libraries:
> auto-patchelf: 2 dependencies could not be satisfied
> error: auto-patchelf could not satisfy dependency libstdc++.so.6 wanted by /nix/store/m70njsq0l1fmkhisfwf83cmr0x8mzw98-PythonCore-253.30387.90/helpers/pydev/pydevd_attach_to_process/attach_linux_amd64.so
> error: auto-patchelf could not satisfy dependency libgcc_s.so.1 wanted by /nix/store/m70njsq0l1fmkhisfwf83cmr0x8mzw98-PythonCore-253.30387.90/helpers/pydev/pydevd_attach_to_process/attach_linux_amd64.so```
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
Signed-off-by: SamueleFacenda <samuele.facenda@gmail.com>
d3a3eff to
0196a8e
Compare
fixes #171
I translated nixpkgs plugin ids -> plugin names, but I'm not sure (e.g. python-ce vs python).