appflowy: modernize

This commit is contained in:
Alexis Hildebrandt 2024-07-16 00:04:12 +02:00
parent a0c617a0a9
commit 0e4dbceba0

View File

@ -1,4 +1,4 @@
{ stdenv { stdenvNoCC
, lib , lib
, fetchzip , fetchzip
, autoPatchelfHook , autoPatchelfHook
@ -22,14 +22,14 @@ let
hash = "sha256-gx+iMo2611uoR549gpBoHlp2h6zQtugPZnU9qbH6VIQ="; hash = "sha256-gx+iMo2611uoR549gpBoHlp2h6zQtugPZnU9qbH6VIQ=";
}; };
aarch64-darwin = x86_64-darwin; aarch64-darwin = x86_64-darwin;
}."${stdenv.hostPlatform.system}"; }."${stdenvNoCC.hostPlatform.system}";
in in
stdenv.mkDerivation rec { stdenvNoCC.mkDerivation (finalAttrs: {
pname = "appflowy"; pname = "appflowy";
version = "0.6.4"; version = "0.6.4";
src = fetchzip { src = fetchzip {
url = "https://github.com/AppFlowy-IO/appflowy/releases/download/${version}/AppFlowy-${version}-${dist.urlSuffix}"; url = "https://github.com/AppFlowy-IO/appflowy/releases/download/${finalAttrs.version}/AppFlowy-${finalAttrs.version}-${dist.urlSuffix}";
inherit (dist) hash; inherit (dist) hash;
stripRoot = false; stripRoot = false;
}; };
@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ nativeBuildInputs = [
makeWrapper makeWrapper
copyDesktopItems copyDesktopItems
] ++ lib.optionals stdenv.isLinux [ ] ++ lib.optionals stdenvNoCC.isLinux [
autoPatchelfHook autoPatchelfHook
]; ];
@ -50,13 +50,12 @@ stdenv.mkDerivation rec {
dontBuild = true; dontBuild = true;
dontConfigure = true; dontConfigure = true;
installPhase = lib.optionalString stdenv.isLinux '' installPhase = lib.optionalString stdenvNoCC.isLinux ''
runHook preInstall runHook preInstall
cd AppFlowy/ cd AppFlowy/
mkdir -p $out/opt/ mkdir -p $out/{bin,opt}
mkdir -p $out/bin/
# Copy archive contents to the outpout directory # Copy archive contents to the outpout directory
cp -r ./* $out/opt/ cp -r ./* $out/opt/
@ -65,7 +64,7 @@ stdenv.mkDerivation rec {
install -Dm444 data/flutter_assets/assets/images/flowy_logo.svg $out/share/icons/hicolor/scalable/apps/appflowy.svg install -Dm444 data/flutter_assets/assets/images/flowy_logo.svg $out/share/icons/hicolor/scalable/apps/appflowy.svg
runHook postInstall runHook postInstall
'' + lib.optionalString stdenv.isDarwin '' '' + lib.optionalString stdenvNoCC.isDarwin ''
runHook preInstall runHook preInstall
mkdir -p $out/{Applications,bin} mkdir -p $out/{Applications,bin}
@ -74,20 +73,20 @@ stdenv.mkDerivation rec {
runHook postInstall runHook postInstall
''; '';
preFixup = lib.optionalString stdenv.isLinux '' preFixup = lib.optionalString stdenvNoCC.isLinux ''
# Add missing libraries to appflowy using the ones it comes with # Add missing libraries to appflowy using the ones it comes with
makeWrapper $out/opt/AppFlowy $out/bin/appflowy \ makeWrapper $out/opt/AppFlowy $out/bin/appflowy \
--set LD_LIBRARY_PATH "$out/opt/lib/" \ --set LD_LIBRARY_PATH "$out/opt/lib/" \
--prefix PATH : "${lib.makeBinPath [ xdg-user-dirs ]}" --prefix PATH : "${lib.makeBinPath [ xdg-user-dirs ]}"
'' + lib.optionalString stdenv.isDarwin '' '' + lib.optionalString stdenvNoCC.isDarwin ''
makeWrapper $out/Applications/AppFlowy.app/Contents/MacOS/AppFlowy $out/bin/appflowy makeWrapper $out/Applications/AppFlowy.app/Contents/MacOS/AppFlowy $out/bin/appflowy
''; '';
desktopItems = lib.optionals stdenv.isLinux [ desktopItems = lib.optionals stdenvNoCC.isLinux [
(makeDesktopItem { (makeDesktopItem {
name = pname; name = "appflowy";
desktopName = "AppFlowy"; desktopName = "AppFlowy";
comment = meta.description; comment = finalAttrs.meta.description;
exec = "appflowy"; exec = "appflowy";
icon = "appflowy"; icon = "appflowy";
categories = [ "Office" ]; categories = [ "Office" ];
@ -99,9 +98,9 @@ stdenv.mkDerivation rec {
homepage = "https://www.appflowy.io/"; homepage = "https://www.appflowy.io/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.agpl3Only; 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 ]; maintainers = with maintainers; [ darkonion0 ];
platforms = [ "x86_64-linux" ] ++ platforms.darwin; platforms = [ "x86_64-linux" ] ++ platforms.darwin;
mainProgram = "appflowy"; mainProgram = "appflowy";
}; };
} })