Skip to content

Commit

Permalink
jetbrains: fix plugin support for darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianPonce committed Jul 31, 2023
1 parent de00058 commit 1153e1c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion pkgs/applications/editors/jetbrains/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ let
loname = lib.toLower productShort;
in
stdenvNoCC.mkDerivation {
inherit pname meta src version plugins;
inherit pname src version plugins product;
passthru.buildNumber = buildNumber;
meta = meta // { mainProgram = loname; };
desktopName = product;
installPhase = ''
runHook preInstall
Expand Down
16 changes: 13 additions & 3 deletions pkgs/applications/editors/jetbrains/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,33 @@ rec {
passthru.plugins = plugins ++ (ide.plugins or [ ]);
newPlugins = plugins;
disallowedReferences = [ ide ];
nativeBuildInputs = [ autoPatchelfHook ] ++ (ide.nativeBuildInputs or [ ]);
nativeBuildInputs = (lib.optional stdenv.isLinux autoPatchelfHook) ++ (ide.nativeBuildInputs or [ ]);
buildInputs = lib.unique ((ide.buildInputs or [ ]) ++ [ glib ]);

inherit (ide) meta;

buildPhase =
let
pluginCmdsLines = map (plugin: "ln -s ${plugin} \"$out\"/${meta.mainProgram}/plugins/${baseNameOf plugin}") plugins;
rootDir=if !stdenv.isDarwin then meta.mainProgram else "Applications/${ide.product}.app/Contents";
pluginCmdsLines = map (plugin: "ln -s ${plugin} \"$out/${rootDir}/plugins/${baseNameOf plugin}\"") plugins;
pluginCmds = builtins.concatStringsSep "\n" pluginCmdsLines;
extraBuildPhase = rec {
clion = ''
sed "s|${ide}|$out|" -i $out/bin/.clion-wrapped
'';
goland = ''
sed "s|${ide}|$out|" -i $out/bin/.goland-wrapped
'';
};
patchElfCmd = lib.optionalString stdenv.isLinux "autoPatchelf \"$out/${meta.mainProgram}/bin\"";
in
''
cp -r ${ide} $out
chmod +w -R $out
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}) \
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.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
};
"7322" = {
# Python community edition
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
};
"8182" = {
# Rust
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
buildPhase = ''
runHook preBuild
Expand Down

0 comments on commit 1153e1c

Please sign in to comment.