mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-28 08:33:54 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
113 lines
3.0 KiB
Nix
113 lines
3.0 KiB
Nix
{
|
|
stdenvNoCC,
|
|
lib,
|
|
fetchzip,
|
|
autoPatchelfHook,
|
|
makeWrapper,
|
|
copyDesktopItems,
|
|
makeDesktopItem,
|
|
gtk3,
|
|
xdg-user-dirs,
|
|
keybinder3,
|
|
libnotify,
|
|
}:
|
|
|
|
let
|
|
dist =
|
|
rec {
|
|
x86_64-linux = {
|
|
urlSuffix = "linux-x86_64.tar.gz";
|
|
hash = "sha256-fn1UK8+7+vFL4nTnnRbfjCgttVYSw6pmmqabeHqTY3g=";
|
|
};
|
|
x86_64-darwin = {
|
|
urlSuffix = "macos-universal.zip";
|
|
hash = "sha256-MoK6GlGmRVRp6feH8hab4CYpP4bXJN3XH7eHHSnhpS4=";
|
|
};
|
|
aarch64-darwin = x86_64-darwin;
|
|
}
|
|
."${stdenvNoCC.hostPlatform.system}"
|
|
or (throw "appflowy: No source for system: ${stdenvNoCC.hostPlatform.system}");
|
|
in
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "appflowy";
|
|
version = "0.7.1";
|
|
|
|
src = fetchzip {
|
|
url = "https://github.com/AppFlowy-IO/appflowy/releases/download/${finalAttrs.version}/AppFlowy-${finalAttrs.version}-${dist.urlSuffix}";
|
|
inherit (dist) hash;
|
|
stripRoot = false;
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
copyDesktopItems
|
|
] ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ];
|
|
|
|
buildInputs = [
|
|
gtk3
|
|
keybinder3
|
|
libnotify
|
|
];
|
|
|
|
dontBuild = true;
|
|
dontConfigure = true;
|
|
|
|
installPhase =
|
|
lib.optionalString stdenvNoCC.hostPlatform.isLinux ''
|
|
runHook preInstall
|
|
|
|
cd AppFlowy/
|
|
|
|
mkdir -p $out/{bin,opt}
|
|
|
|
# Copy archive contents to the outpout directory
|
|
cp -r ./* $out/opt/
|
|
|
|
# Copy icon
|
|
install -Dm444 data/flutter_assets/assets/images/flowy_logo.svg $out/share/icons/hicolor/scalable/apps/appflowy.svg
|
|
|
|
runHook postInstall
|
|
''
|
|
+ lib.optionalString stdenvNoCC.hostPlatform.isDarwin ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/{Applications,bin}
|
|
cp -r ./AppFlowy.app $out/Applications/
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
preFixup =
|
|
lib.optionalString stdenvNoCC.hostPlatform.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.hostPlatform.isDarwin ''
|
|
makeWrapper $out/Applications/AppFlowy.app/Contents/MacOS/AppFlowy $out/bin/appflowy
|
|
'';
|
|
|
|
desktopItems = lib.optionals stdenvNoCC.hostPlatform.isLinux [
|
|
(makeDesktopItem {
|
|
name = "appflowy";
|
|
desktopName = "AppFlowy";
|
|
comment = finalAttrs.meta.description;
|
|
exec = "appflowy";
|
|
icon = "appflowy";
|
|
categories = [ "Office" ];
|
|
})
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "An open-source alternative to Notion";
|
|
homepage = "https://www.appflowy.io/";
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
|
license = licenses.agpl3Only;
|
|
changelog = "https://github.com/AppFlowy-IO/appflowy/releases/tag/${finalAttrs.version}";
|
|
maintainers = with maintainers; [ darkonion0 ];
|
|
platforms = [ "x86_64-linux" ] ++ platforms.darwin;
|
|
mainProgram = "appflowy";
|
|
};
|
|
})
|