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 [