about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorLily Foster2024-04-22 11:37:39 -0400
committerGitHub2024-04-22 11:37:39 -0400
commitada481d696383af3d8bec06577d10b131f200e18 (patch)
tree6ddc57ce0f83852b59c37990c92e46e4fdd51332 /pkgs
parent1da38179a3993d0ef9bbb672a69cf4466a758130 (diff)
parent14ef362b0fd986acd4e6b969929593138da76bf5 (diff)
Merge pull request #304439 from Qyriad/package/cinny
cinny-desktop: add macOS support
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/networking/instant-messengers/cinny-desktop/default.nix30
1 files changed, 25 insertions, 5 deletions
diff --git a/pkgs/applications/networking/instant-messengers/cinny-desktop/default.nix b/pkgs/applications/networking/instant-messengers/cinny-desktop/default.nix
index 9777dca11c59..841df5a4cd61 100644
--- a/pkgs/applications/networking/instant-messengers/cinny-desktop/default.nix
+++ b/pkgs/applications/networking/instant-messengers/cinny-desktop/default.nix
@@ -1,6 +1,10 @@
 { lib
+, stdenv
+, darwin
 , fetchFromGitHub
+, rust
 , rustPlatform
+, cargo-tauri
 , cinny
 , copyDesktopItems
 , wrapGAppsHook
@@ -16,6 +20,7 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "cinny-desktop";
+  # We have to be using the same version as cinny-web or this isn't going to work.
   version = "3.1.0";
 
   src = fetchFromGitHub {
@@ -37,33 +42,48 @@ rustPlatform.buildRustPackage rec {
   in ''
     substituteInPlace tauri.conf.json \
       --replace '"distDir": "../cinny/dist",' '"distDir": "${cinny'}",'
-
+    substituteInPlace tauri.conf.json \
+      --replace '"cd cinny && npm run build"' '""'
+  '' + lib.optionalString stdenv.hostPlatform.isLinux ''
     substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
       --replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
   '';
 
-  postInstall = ''
+  postBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
+    cargo tauri build --bundles app --target "${rust.envVars.rustHostPlatform}"
+  '';
+
+  postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
     install -DT icons/128x128@2x.png $out/share/icons/hicolor/256x256@2/apps/cinny.png
     install -DT icons/128x128.png $out/share/icons/hicolor/128x128/apps/cinny.png
     install -DT icons/32x32.png $out/share/icons/hicolor/32x32/apps/cinny.png
+  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
+    mkdir -p "$out/Applications/"
+    cp -r "target/${rust.envVars.rustHostPlatform}/release/bundle/macos/Cinny.app" "$out/Applications/"
+    ln -sf "$out/Applications/Cinny.app/Contents/MacOS/Cinny" "$out/bin/cinny"
   '';
 
   nativeBuildInputs = [
     copyDesktopItems
     wrapGAppsHook
     pkg-config
+    cargo-tauri
   ];
 
   buildInputs = [
     openssl
     dbus
     glib
+  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
     glib-networking
     libayatana-appindicator
     webkitgtk
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    darwin.DarwinTools
+    darwin.apple_sdk.frameworks.WebKit
   ];
 
-  desktopItems = [
+  desktopItems = lib.optionals stdenv.hostPlatform.isLinux [
     (makeDesktopItem {
       name = "cinny";
       exec = "cinny";
@@ -77,9 +97,9 @@ rustPlatform.buildRustPackage rec {
   meta = with lib; {
     description = "Yet another matrix client for desktop";
     homepage = "https://github.com/cinnyapp/cinny-desktop";
-    maintainers = [ ];
+    maintainers = with maintainers; [ qyriad ];
     license = licenses.agpl3Only;
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
     mainProgram = "cinny";
   };
 }