about summary refs log tree commit diff
path: root/pkgs/applications/office/jameica/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/office/jameica/default.nix')
-rw-r--r--pkgs/applications/office/jameica/default.nix18
1 files changed, 13 insertions, 5 deletions
diff --git a/pkgs/applications/office/jameica/default.nix b/pkgs/applications/office/jameica/default.nix
index f87eaf6d9e4d..3f9e20d7a042 100644
--- a/pkgs/applications/office/jameica/default.nix
+++ b/pkgs/applications/office/jameica/default.nix
@@ -24,6 +24,7 @@ let
     else if stdenv.hostPlatform.system == "x86_64-linux" then "linux64"
     else if stdenv.hostPlatform.system == "aarch64-linux" then "linux-arm64"
     else if stdenv.hostPlatform.system == "x86_64-darwin" then "macos64"
+    else if stdenv.hostPlatform.system == "aarch64-darwin" then "macos-aarch64"
     else throw "Unsupported system: ${stdenv.hostPlatform.system}";
 
   desktopItem = makeDesktopItem {
@@ -48,8 +49,8 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ ant jdk wrapGAppsHook3 makeWrapper stripJavaArchivesHook ];
-  buildInputs = lib.optionals stdenv.isLinux [ gtk2 glib libXtst ]
-    ++ lib.optional stdenv.isDarwin Cocoa;
+  buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ gtk2 glib libXtst ]
+    ++ lib.optional stdenv.hostPlatform.isDarwin Cocoa;
 
   dontWrapGApps = true;
 
@@ -57,7 +58,7 @@ stdenv.mkDerivation rec {
   # and is not able to build the application itself
   buildPhase = ''
     runHook preBuild
-    ant -f build -Dsystem.version=${version} init compile jar
+    ant -f build -Dsystem.version=${version} init compile jar ${lib.optionalString stdenv.hostPlatform.isDarwin "zip lib"}
     runHook postBuild
   '';
 
@@ -75,6 +76,13 @@ stdenv.mkDerivation rec {
     install -Dm644 plugin.xml $out/share/java/
     install -Dm644 build/jameica-icon.png $out/share/pixmaps/jameica.png
     cp ${desktopItem}/share/applications/* $out/share/applications/
+  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
+
+    # Create .app bundle for macOS
+    mkdir -p $out/Applications
+    chmod +x releases/${_version}-${_build}-${_build}/tmp/jameica.app/jameica*.sh
+    cp -r releases/${_version}-${_build}-${_build}/tmp/jameica.app $out/Applications/Jameica.app
+  '' + ''
 
     runHook postInstall
   '';
@@ -82,7 +90,7 @@ stdenv.mkDerivation rec {
   postFixup = ''
     makeWrapper ${jre}/bin/java $out/bin/jameica \
       --add-flags "-cp $out/share/java/jameica.jar:$out/share/jameica-${version}/* ${
-        lib.optionalString stdenv.isDarwin ''-Xdock:name="Jameica" -XstartOnFirstThread''
+        lib.optionalString stdenv.hostPlatform.isDarwin ''-Xdock:name="Jameica" -XstartOnFirstThread''
       } de.willuhn.jameica.Main" \
       --prefix LD_LIBRARY_PATH : ${lib.escapeShellArg (lib.makeLibraryPath buildInputs)} \
       --chdir "$out/share/java/" \
@@ -101,7 +109,7 @@ stdenv.mkDerivation rec {
       binaryBytecode # source bundles dependencies as jars
     ];
     license = licenses.gpl2Plus;
-    platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
+    platforms = platforms.unix;
     maintainers = with maintainers; [ flokli r3dl3g ];
     mainProgram = "jameica";
   };