diff --git a/pkgs/applications/editors/jetbrains/bin/darwin.nix b/pkgs/applications/editors/jetbrains/bin/darwin.nix index 747f03f55d5e9..f5edf904726b0 100644 --- a/pkgs/applications/editors/jetbrains/bin/darwin.nix +++ b/pkgs/applications/editors/jetbrains/bin/darwin.nix @@ -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 = '' diff --git a/pkgs/applications/editors/jetbrains/plugins/default.nix b/pkgs/applications/editors/jetbrains/plugins/default.nix index 93e6ca28608fa..1fcc8a15a834e 100644 --- a/pkgs/applications/editors/jetbrains/plugins/default.nix +++ b/pkgs/applications/editors/jetbrains/plugins/default.nix @@ -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 ''; }; diff --git a/pkgs/applications/editors/jetbrains/plugins/specialPlugins.nix b/pkgs/applications/editors/jetbrains/plugins/specialPlugins.nix index 574938eef0d32..513f0e3d74f98 100644 --- a/pkgs/applications/editors/jetbrains/plugins/specialPlugins.nix +++ b/pkgs/applications/editors/jetbrains/plugins/specialPlugins.nix @@ -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 @@ -65,7 +65,7 @@ }; "22407" = { # Rust - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook; buildInputs = [ stdenv.cc.cc.lib ]; buildPhase = '' runHook preBuild