jetbrains.plugins: fix darwin builds
There were 2 issues for usage of `jetbrains.plugins.addPlugins` in darwin: - Some IDE products have spaces in name (e.g.: "IntelliJ IDEA CE"). The current code didn't escape or quoted the strings together, so it failed during build - After fixing the issue above, opening the resulting app bundle (e.g.: `open result/Applications/IntelliJ IDEA CE`) would result in an error because we modified the bundle but kept the old signature This commit fixes both those issues, the first one by quoting the IDE name using `lib.escapeShellArg` and the second one by using `darwin.autoSignDarwinBinariesHook`.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
, callPackage
|
||||
, autoPatchelfHook
|
||||
, glib
|
||||
, darwin
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -86,18 +87,24 @@ in {
|
||||
version = ide.version;
|
||||
src = ide;
|
||||
dontInstall = true;
|
||||
dontFixup = true;
|
||||
dontStrip = true;
|
||||
passthru.plugins = plugins ++ (ide.plugins or [ ]);
|
||||
newPlugins = plugins;
|
||||
disallowedReferences = [ ide ];
|
||||
nativeBuildInputs = (lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook) ++ (ide.nativeBuildInputs or [ ]);
|
||||
nativeBuildInputs =
|
||||
(lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook)
|
||||
# The buildPhase hook rewrites the binary, which invaliates the code
|
||||
# signature. Add the fixup hook to sign the output.
|
||||
++ (lib.optional stdenv.hostPlatform.isDarwin darwin.autoSignDarwinBinariesHook)
|
||||
++ (ide.nativeBuildInputs or [ ]);
|
||||
buildInputs = lib.unique ((ide.buildInputs or [ ]) ++ [ glib ]);
|
||||
|
||||
inherit (ide) meta;
|
||||
|
||||
buildPhase =
|
||||
let
|
||||
rootDir = if stdenv.hostPlatform.isDarwin then "Applications/${ide.product}.app/Contents" else meta.mainProgram;
|
||||
appDir = lib.optionalString stdenv.hostPlatform.isDarwin "Applications/${lib.escapeShellArg ide.product}.app";
|
||||
rootDir = if stdenv.hostPlatform.isDarwin then "${appDir}/Contents" else meta.mainProgram;
|
||||
in
|
||||
''
|
||||
cp -r ${ide} $out
|
||||
|
||||
Reference in New Issue
Block a user