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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
{ addOpenGLRunpath
, alsa-lib
, at-spi2-atk
, at-spi2-core
, atk
, autoPatchelfHook
, cairo
, cups
, curl
, dbus
, dpkg
, expat
, fetchurl
, fontconfig
, freetype
, gdk-pixbuf
, glib
, glibc
, gnutls
, gtk3
, lib
, libGL
, libX11
, libXScrnSaver
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
, libappindicator-gtk3
, libcxx
, libdbusmenu
, libdrm
, libgcrypt
, libglvnd
, libnotify
, libpulseaudio
, libuuid
, libxcb
, libxkbcommon
, libxkbfile
, libxshmfence
, makeShellWrapper
, mesa
, nspr
, nss
, pango
, pciutils
, pipewire
, pixman
, stdenv
, systemd
, wayland
, wrapGAppsHook
, xdg-utils
# for custom command line arguments, e.g. "--use-gl=desktop"
, commandLineArgs ? ""
}:
stdenv.mkDerivation rec {
version = "6.9.20";
pname = "feishu";
packageHash = "6085d1c4"; # A hash value used in the download url
src = fetchurl {
url = "https://sf3-cn.feishucdn.com/obj/ee-appcenter/${packageHash}/Feishu-linux_x64-${version}.deb";
hash = "sha256-kg5j/vWaCBUjnF983kk0ZMJ+inF5z5ctED9+ITuIn94=";
};
nativeBuildInputs = [
autoPatchelfHook
makeShellWrapper
dpkg
];
buildInputs = [
gtk3
# for autopatchelf
alsa-lib
cups
curl
libXdamage
libXtst
libdrm
libgcrypt
libpulseaudio
libxshmfence
mesa
nspr
nss
];
rpath = lib.makeLibraryPath [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
curl
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
glibc
gnutls
libGL
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
libappindicator-gtk3
libcxx
libdbusmenu
libdrm
libgcrypt
libglvnd
libnotify
libpulseaudio
libuuid
libxcb
libxkbcommon
libxkbfile
libxshmfence
mesa
nspr
nss
pango
pciutils
pipewire
pixman
stdenv.cc.cc
systemd
wayland
xdg-utils
];
dontUnpack = true;
installPhase = ''
# This deb file contains a setuid binary,
# so 'dpkg -x' doesn't work here.
dpkg --fsys-tarfile $src | tar --extract
mkdir -p $out
mv usr/share $out/
mv opt/ $out/
substituteInPlace $out/share/applications/bytedance-feishu.desktop \
--replace /usr/bin/bytedance-feishu-stable $out/opt/bytedance/feishu/bytedance-feishu
# Wrap feishu and vulcan
# Feishu is the main executable, vulcan is the builtin browser
for executable in $out/opt/bytedance/feishu/{feishu,vulcan/vulcan}; do
wrapProgram $executable \
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \
--prefix LD_LIBRARY_PATH : ${rpath}:$out/opt/bytedance/feishu:${addOpenGLRunpath.driverLink}/share \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
${lib.optionalString (commandLineArgs!="") "--add-flags ${lib.escapeShellArg commandLineArgs}"}
done
mkdir -p $out/share/icons/hicolor
base="$out/opt/bytedance/feishu"
for size in 16 24 32 48 64 128 256; do
mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps
ln -s $base/product_logo_$size.png $out/share/icons/hicolor/''${size}x''${size}/apps/bytedance-feishu.png
done
mkdir -p $out/bin
ln -s $out/opt/bytedance/feishu/bytedance-feishu $out/bin/bytedance-feishu
# feishu comes with a bundled libcurl.so
# and has many dependencies that are hard to satisfy
# e.g. openldap version 2.4
# so replace it with our own libcurl.so
ln -sf ${curl}/lib/libcurl.so $out/opt/bytedance/feishu/libcurl.so
'';
meta = with lib; {
description = "An all-in-one collaboration suite";
homepage = "https://www.feishu.cn/en/";
downloadPage = "https://www.feishu.cn/en/#en_home_download_block";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ billhuang ];
};
}
|