diff options
Diffstat (limited to 'pkgs/applications/office/appflowy/default.nix')
-rw-r--r-- | pkgs/applications/office/appflowy/default.nix | 107 |
1 files changed, 67 insertions, 40 deletions
diff --git a/pkgs/applications/office/appflowy/default.nix b/pkgs/applications/office/appflowy/default.nix index 62315b6c2ae58..4d5e23b12205f 100644 --- a/pkgs/applications/office/appflowy/default.nix +++ b/pkgs/applications/office/appflowy/default.nix @@ -1,31 +1,46 @@ -{ stdenv -, lib -, fetchzip -, autoPatchelfHook -, makeWrapper -, copyDesktopItems -, makeDesktopItem -, gtk3 -, xdg-user-dirs -, keybinder3 -, libnotify +{ + stdenvNoCC, + lib, + fetchzip, + autoPatchelfHook, + makeWrapper, + copyDesktopItems, + makeDesktopItem, + gtk3, + xdg-user-dirs, + keybinder3, + libnotify, }: -stdenv.mkDerivation rec { +let + dist = + rec { + x86_64-linux = { + urlSuffix = "linux-x86_64.tar.gz"; + hash = "sha256-PVlHPjr6aUkTp9x4MVC8cgebmdaUQXX6eV0/LfAmiJc="; + }; + x86_64-darwin = { + urlSuffix = "macos-universal.zip"; + hash = "sha256-gx+iMo2611uoR549gpBoHlp2h6zQtugPZnU9qbH6VIQ="; + }; + aarch64-darwin = x86_64-darwin; + } + ."${stdenvNoCC.hostPlatform.system}"; +in +stdenvNoCC.mkDerivation (finalAttrs: { pname = "appflowy"; - version = "0.6.1"; + version = "0.6.4"; src = fetchzip { - url = "https://github.com/AppFlowy-IO/appflowy/releases/download/${version}/AppFlowy-${version}-linux-x86_64.tar.gz"; - hash = "sha256-a8oupvBtT3sKhboSeS/GbVSauKXx54J4WZd+PyIbuzU="; + url = "https://github.com/AppFlowy-IO/appflowy/releases/download/${finalAttrs.version}/AppFlowy-${finalAttrs.version}-${dist.urlSuffix}"; + inherit (dist) hash; stripRoot = false; }; nativeBuildInputs = [ - autoPatchelfHook makeWrapper copyDesktopItems - ]; + ] ++ lib.optionals stdenvNoCC.isLinux [ autoPatchelfHook ]; buildInputs = [ gtk3 @@ -36,35 +51,47 @@ stdenv.mkDerivation rec { dontBuild = true; dontConfigure = true; - installPhase = '' - runHook preInstall + installPhase = + lib.optionalString stdenvNoCC.isLinux '' + runHook preInstall + + cd AppFlowy/ + + mkdir -p $out/{bin,opt} - cd AppFlowy/ + # Copy archive contents to the outpout directory + cp -r ./* $out/opt/ - mkdir -p $out/opt/ - mkdir -p $out/bin/ + # Copy icon + install -Dm444 data/flutter_assets/assets/images/flowy_logo.svg $out/share/icons/hicolor/scalable/apps/appflowy.svg - # Copy archive contents to the outpout directory - cp -r ./* $out/opt/ + runHook postInstall + '' + + lib.optionalString stdenvNoCC.isDarwin '' + runHook preInstall - # Copy icon - install -Dm444 data/flutter_assets/assets/images/flowy_logo.svg $out/share/icons/hicolor/scalable/apps/appflowy.svg + mkdir -p $out/{Applications,bin} + cp -r ./AppFlowy.app $out/Applications/ - runHook postInstall - ''; + runHook postInstall + ''; - preFixup = '' - # Add missing libraries to appflowy using the ones it comes with - makeWrapper $out/opt/AppFlowy $out/bin/appflowy \ - --set LD_LIBRARY_PATH "$out/opt/lib/" \ - --prefix PATH : "${lib.makeBinPath [ xdg-user-dirs ]}" - ''; + preFixup = + lib.optionalString stdenvNoCC.isLinux '' + # Add missing libraries to appflowy using the ones it comes with + makeWrapper $out/opt/AppFlowy $out/bin/appflowy \ + --set LD_LIBRARY_PATH "$out/opt/lib/" \ + --prefix PATH : "${lib.makeBinPath [ xdg-user-dirs ]}" + '' + + lib.optionalString stdenvNoCC.isDarwin '' + makeWrapper $out/Applications/AppFlowy.app/Contents/MacOS/AppFlowy $out/bin/appflowy + ''; - desktopItems = [ + desktopItems = lib.optionals stdenvNoCC.isLinux [ (makeDesktopItem { - name = pname; + name = "appflowy"; desktopName = "AppFlowy"; - comment = meta.description; + comment = finalAttrs.meta.description; exec = "appflowy"; icon = "appflowy"; categories = [ "Office" ]; @@ -76,9 +103,9 @@ stdenv.mkDerivation rec { homepage = "https://www.appflowy.io/"; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.agpl3Only; - changelog = "https://github.com/AppFlowy-IO/appflowy/releases/tag/${version}"; + changelog = "https://github.com/AppFlowy-IO/appflowy/releases/tag/${finalAttrs.version}"; maintainers = with maintainers; [ darkonion0 ]; - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" ] ++ platforms.darwin; mainProgram = "appflowy"; }; -} +}) |