summary refs log tree commit diff
path: root/pkgs/applications/office/qownnotes
diff options
context:
space:
mode:
authorMatthias Thym <git@thym.at>2023-01-08 20:17:31 +0100
committerMatthias Thym <git@thym.at>2023-01-08 20:17:31 +0100
commit7d7d53185d842e1b6dd01689df8fa98c3b0c155e (patch)
treef245824f1aa55794ffa36e19ec58bbc718ff179a /pkgs/applications/office/qownnotes
parent9cf14ec94a853f20fe7d8046cac376fe5ae6a50c (diff)
qownnotes: add darwin support
Diffstat (limited to 'pkgs/applications/office/qownnotes')
-rw-r--r--pkgs/applications/office/qownnotes/default.nix26
1 files changed, 23 insertions, 3 deletions
diff --git a/pkgs/applications/office/qownnotes/default.nix b/pkgs/applications/office/qownnotes/default.nix
index bb27f0d4ec906..7b1a7a5914079 100644
--- a/pkgs/applications/office/qownnotes/default.nix
+++ b/pkgs/applications/office/qownnotes/default.nix
@@ -3,9 +3,13 @@
 , qtx11extras, qtwayland
 }:
 
-mkDerivation rec {
+let
   pname = "qownnotes";
+  appname = "QOwnNotes";
   version = "22.12.3";
+in
+stdenv.mkDerivation {
+  inherit pname appname version;
 
   src = fetchurl {
     url = "https://download.tuxfamily.org/${pname}/src/${pname}-${version}.tar.xz";
@@ -14,16 +18,32 @@ mkDerivation rec {
     sha256 = "sha256-fpI7RYOGmWwmau6tF8FPmY2/FtN9foWRX8/WgrNU6E8=";
   };
 
-  nativeBuildInputs = [ qmake qttools ];
+  nativeBuildInputs = [
+    qmake
+    qttools
+    wrapQtAppsHook
+  ] ++ lib.optionals stdenv.isDarwin [ makeWrapper ];
 
   buildInputs = [ qtbase qtsvg qtdeclarative qtxmlpatterns qtwebsockets qtx11extras ]
     ++ lib.optionals stdenv.isLinux [ qtwayland ];
 
+  postInstall =
+  # Create a lowercase symlink for Linux
+  lib.optionalString stdenv.isLinux ''
+    ln -s $out/bin/${appname} $out/bin/${pname}
+  ''
+  # Wrap application for macOS as lowercase binary
+  + lib.optionalString stdenv.isDarwin ''
+    mkdir -p $out/Applications
+    mv $out/bin/${appname}.app $out/Applications
+    makeWrapper $out/Applications/${appname}.app/Contents/MacOS/${appname} $out/bin/${pname}
+  '';
+
   meta = with lib; {
     description = "Plain-text file notepad and todo-list manager with markdown support and Nextcloud/ownCloud integration";
     homepage = "https://www.qownnotes.org/";
     license = licenses.gpl2Only;
     maintainers = with maintainers; [ totoroot ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }