-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Expand file tree
/
Copy pathpackage.nix
More file actions
135 lines (119 loc) · 3.36 KB
/
package.nix
File metadata and controls
135 lines (119 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
stdenvNoCC,
lib,
fetchzip,
autoPatchelfHook,
makeWrapper,
copyDesktopItems,
makeDesktopItem,
gtk3,
xdg-user-dirs,
keybinder3,
libnotify,
gst_all_1,
libva,
libvdpau,
lcms2,
libarchive,
alsa-lib,
libpulseaudio,
libgbm,
libxscrnsaver,
libxv,
}:
let
dist =
rec {
x86_64-linux = {
urlSuffix = "linux-x86_64.tar.gz";
hash = "sha256-A2XPADCc63OqskfPpkMwL8jCp9k7QsPyN2/FL+eCpfI=";
};
x86_64-darwin = {
urlSuffix = "macos-universal.zip";
hash = "sha256-YanQYRaGCqq5bOLeSFqUYbq0EtVun80gxGdFJtyZdoI=";
};
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.11.4";
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 = lib.optionals stdenvNoCC.hostPlatform.isLinux [
gtk3
keybinder3
libnotify
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
libva
libvdpau
lcms2
libarchive
alsa-lib
libpulseaudio
libgbm
libxscrnsaver
libxv
];
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 %U";
icon = "appflowy";
categories = [ "Office" ];
mimeTypes = [ "x-scheme-handler/appflowy-flutter" ];
})
];
meta = {
description = "Open-source alternative to Notion";
homepage = "https://www.appflowy.io/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.agpl3Only;
changelog = "https://github.com/AppFlowy-IO/appflowy/releases/tag/${finalAttrs.version}";
maintainers = with lib.maintainers; [ darkonion0 ];
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
mainProgram = "appflowy";
};
})