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: add support for plugins on darwin #242562

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkgs/applications/editors/jetbrains/bin/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ let
loname = lib.toLower productShort;
in
stdenvNoCC.mkDerivation {
inherit pname meta src version plugins;
inherit pname src version plugins;
passthru.buildNumber = buildNumber;
passthru.product = product;
meta = meta // { mainProgram = loname; };
desktopName = product;
dontFixup = true;
installPhase = ''
Expand Down
22 changes: 16 additions & 6 deletions pkgs/applications/editors/jetbrains/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,33 @@ in {
passthru.plugins = plugins ++ (ide.plugins or [ ]);
newPlugins = plugins;
disallowedReferences = [ ide ];
nativeBuildInputs = [ autoPatchelfHook ] ++ (ide.nativeBuildInputs or [ ]);
nativeBuildInputs = (lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook) ++ (ide.nativeBuildInputs or [ ]);
buildInputs = lib.unique ((ide.buildInputs or [ ]) ++ [ glib ]);

inherit (ide) meta;

buildPhase = ''
buildPhase =
let
rootDir = if stdenv.hostPlatform.isDarwin then "Applications/${ide.product}.app/Contents" else meta.mainProgram;
in
''
cp -r ${ide} $out
chmod +w -R $out
rm -f $out/${meta.mainProgram}/plugins/plugin-classpath.txt
rm -f $out/${rootDir}/plugins/plugin-classpath.txt
IFS=' ' read -ra pluginArray <<< "$newPlugins"
for plugin in "''${pluginArray[@]}"
do
ln -s "$plugin" -t $out/${meta.mainProgram}/plugins/
ln -s "$plugin" -t "$out/${rootDir}/plugins/"
done
sed "s|${ide.outPath}|$out|" \
-i $(realpath $out/bin/${meta.mainProgram}) \
-i $(realpath $out/bin/${meta.mainProgram}-remote-dev-server)
-i $(realpath $out/bin/${meta.mainProgram})

if test -f "$out/bin/${meta.mainProgram}-remote-dev-server"; then
sed "s|${ide.outPath}|$out|" \
-i $(realpath $out/bin/${meta.mainProgram}-remote-dev-server)
fi

'' + lib.optionalString stdenv.hostPlatform.isLinux ''
autoPatchelf $out
'';
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
{
"631" = {
# Python
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
};
"7322" = {
# Python community edition
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
};
"8182" = {
# Rust (deprecated)
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
buildPhase = ''
runHook preBuild
Expand Down Expand Up @@ -65,7 +65,7 @@
};
"22407" = {
# Rust
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
buildPhase = ''
runHook preBuild
Expand Down