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
201
202
|
{ stdenv
, lib
, fetchurl
, pipewire
, makeWrapper
, xar
, cpio
# Dynamic libraries
, alsa-lib
, atk
, at-spi2-atk
, at-spi2-core
, cairo
, cups
, dbus
, expat
, libdrm
, libGL
, fontconfig
, freetype
, gtk3
, gdk-pixbuf
, glib
, mesa
, nspr
, nss
, pango
, wayland
, xorg
, libxkbcommon
, udev
, zlib
, libkrb5
# Runtime
, coreutils
, pciutils
, procps
, util-linux
, pulseaudioSupport ? true
, libpulseaudio
}:
let
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
# Zoom versions are released at different times for each platform
# and often with different versions. We write them on three lines
# like this (rather than using {}) so that the updater script can
# find where to edit them.
versions.aarch64-darwin = "6.1.1.36333";
versions.x86_64-darwin = "6.1.1.36333";
versions.x86_64-linux = "6.1.1.443";
srcs = {
aarch64-darwin = fetchurl {
url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64";
name = "zoomusInstallerFull.pkg";
hash = "sha256-CBBJAa7hnz0I2ctEn7DMdzeXEs4x+aEmEr+L42ddqXE=";
};
x86_64-darwin = fetchurl {
url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg";
hash = "sha256-CHtyL/BdyBVCQOGWjP0H/5GJiq67hPNQxELlvzzUuts=";
};
x86_64-linux = fetchurl {
url = "https://zoom.us/client/${versions.x86_64-linux}/zoom_x86_64.pkg.tar.xz";
hash = "sha256-2FOAZ3MKusouuWvhxFEcqX+2e+PCF4N5zaz7mc9Mnq4=";
};
};
libs = lib.makeLibraryPath ([
# $ LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH:$PWD ldd zoom | grep 'not found'
alsa-lib
atk
at-spi2-atk
at-spi2-core
cairo
cups
dbus
expat
libdrm
libGL
pipewire
fontconfig
freetype
gtk3
gdk-pixbuf
glib
mesa
nspr
nss
pango
stdenv.cc.cc
wayland
xorg.libX11
xorg.libxcb
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
libxkbcommon
xorg.libXrandr
xorg.libXrender
xorg.libxshmfence
xorg.xcbutilimage
xorg.xcbutilkeysyms
xorg.xcbutilrenderutil
xorg.xcbutilwm
xorg.libXfixes
xorg.libXtst
udev
zlib
libkrb5
] ++ lib.optional (pulseaudioSupport) libpulseaudio);
in
stdenv.mkDerivation rec {
pname = "zoom";
version = versions.${system} or throwSystem;
src = srcs.${system} or throwSystem;
dontUnpack = stdenv.isLinux;
unpackPhase = lib.optionalString stdenv.isDarwin ''
xar -xf $src
zcat < zoomus.pkg/Payload | cpio -i
'';
nativeBuildInputs = [
makeWrapper
]
++ lib.optionals stdenv.isDarwin [
xar
cpio
];
installPhase = ''
runHook preInstall
${rec {
aarch64-darwin = ''
mkdir -p $out/Applications
cp -R zoom.us.app $out/Applications/
'';
# darwin steps same on both architectures
x86_64-darwin = aarch64-darwin;
x86_64-linux = ''
mkdir $out
tar -C $out -xf $src
mv $out/usr/* $out/
'';
}.${system} or throwSystem}
runHook postInstall
'';
postFixup = lib.optionalString stdenv.isDarwin ''
makeWrapper $out/Applications/zoom.us.app/Contents/MacOS/zoom.us $out/bin/zoom
'' + lib.optionalString stdenv.isLinux ''
# Desktop File
substituteInPlace $out/share/applications/Zoom.desktop \
--replace "Exec=/usr/bin/zoom" "Exec=$out/bin/zoom"
for i in aomhost zopen zoom ZoomLauncher; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/$i
done
# ZoomLauncher sets LD_LIBRARY_PATH before execing zoom
# IPC breaks if the executable name does not end in 'zoom'
mv $out/opt/zoom/zoom $out/opt/zoom/.zoom
makeWrapper $out/opt/zoom/.zoom $out/opt/zoom/zoom \
--prefix LD_LIBRARY_PATH ":" ${libs}
rm $out/bin/zoom
# Zoom expects "zopen" executable (needed for web login) to be present in CWD. Or does it expect
# everybody runs Zoom only after cd to Zoom package directory? Anyway, :facepalm:
# Clear Qt paths to prevent tripping over "foreign" Qt resources.
# Clear Qt screen scaling settings to prevent over-scaling.
makeWrapper $out/opt/zoom/ZoomLauncher $out/bin/zoom \
--chdir "$out/opt/zoom" \
--unset QML2_IMPORT_PATH \
--unset QT_PLUGIN_PATH \
--unset QT_SCREEN_SCALE_FACTORS \
--prefix PATH : ${lib.makeBinPath [ coreutils glib.dev pciutils procps util-linux ]} \
--prefix LD_LIBRARY_PATH ":" ${libs}
# Backwards compatibility: we used to call it zoom-us
ln -s $out/bin/{zoom,zoom-us}
'';
# already done
dontPatchELF = true;
passthru.updateScript = ./update.sh;
meta = with lib; {
homepage = "https://zoom.us/";
description = "zoom.us video conferencing application";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = builtins.attrNames srcs;
maintainers = with maintainers; [ danbst tadfisher ];
mainProgram = "zoom";
};
}
|