From f8cd609d852ba0ae43d2c37f26b302debd131779 Mon Sep 17 00:00:00 2001 From: Nikola Knezevic Date: Tue, 23 May 2023 17:12:36 +0200 Subject: [PATCH] Fix: make Espanso.app on darwin This change creates an app on darwin, as this is expected on the platform. --- pkgs/applications/office/espanso/default.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/office/espanso/default.nix b/pkgs/applications/office/espanso/default.nix index 30bea3e55bd4..180e0f96aeb9 100644 --- a/pkgs/applications/office/espanso/default.nix +++ b/pkgs/applications/office/espanso/default.nix @@ -105,10 +105,24 @@ rustPlatform.buildRustPackage rec { xdotool ]; + postPatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace scripts/create_bundle.sh --replace target/mac/ $out/Applications/ + patchShebangs scripts/create_bundle.sh + substituteInPlace espanso/src/res/macos/Info.plist \ + --replace "espanso" "${placeholder "out"}/Applications/Espanso.app/Contents/MacOS/espanso" + substituteInPlace espanso/src/res/macos/com.federicoterzi.espanso.plist \ + --replace "/Applications/Espanso.app/Contents/MacOS/espanso" "${placeholder "out"}/Applications/Espanso.app/Contents/MacOS/espanso" \ + --replace "/usr/bin" "${placeholder "out"}/bin:/usr/bin" + substituteInPlace espanso/src/path/macos.rs espanso/src/path/linux.rs \ + --replace '"/usr/local/bin/espanso"' '"${placeholder "out"}/bin/espanso"' + ''; + # Some tests require networking doCheck = false; - postInstall = '' + postInstall = if stdenv.isDarwin then '' + EXEC_PATH=$out/bin/espanso BUILD_ARCH=current ${stdenv.shell} ./scripts/create_bundle.sh + '' else '' wrapProgram $out/bin/espanso \ --prefix PATH : ${lib.makeBinPath ( lib.optionals stdenv.isLinux [