zoom-us: fix memory usage bug, add test, update (#381281)

authored by philiptaron.tngl.sh and committed by GitHub b9c01f18 0158769b

+61 -8
+17 -8
pkgs/by-name/zo/zoom-us/package.nix
··· 40 pulseaudioSupport ? true, 41 libpulseaudio, 42 pulseaudio, 43 }: 44 45 let ··· 50 # and often with different versions. We write them on three lines 51 # like this (rather than using {}) so that the updater script can 52 # find where to edit them. 53 - versions.aarch64-darwin = "6.3.1.45300"; 54 - versions.x86_64-darwin = "6.3.1.45300"; 55 - versions.x86_64-linux = "6.2.11.5069"; 56 57 srcs = { 58 aarch64-darwin = fetchurl { 59 url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64"; 60 name = "zoomusInstallerFull.pkg"; 61 - hash = "sha256-WPhqYof/XR6TDkuA4NK2a30ksdhN7NBfs4KCQwqKJ0g="; 62 }; 63 x86_64-darwin = fetchurl { 64 url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg"; 65 - hash = "sha256-BywBvJCcNXARHTkO/UJbOFRjuiXRkmFWmSuZsW9t1pk="; 66 }; 67 x86_64-linux = fetchurl { 68 url = "https://zoom.us/client/${versions.x86_64-linux}/zoom_x86_64.pkg.tar.xz"; 69 - hash = "sha256-k8T/lmfgAFxW1nwEyh61lagrlHP5geT2tA7e5j61+qw="; 70 }; 71 }; 72 ··· 122 coreutils 123 glib.dev 124 pciutils 125 procps 126 util-linux 127 ] ··· 179 substituteInPlace $out/share/applications/Zoom.desktop \ 180 --replace-fail "Exec=/usr/bin/zoom" "Exec=$out/bin/zoom" 181 182 - for i in aomhost zopen zoom ZoomLauncher ZoomWebviewHost; do 183 if [ -f $out/opt/zoom/$i ]; then 184 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/$i 185 fi ··· 187 188 # ZoomLauncher sets LD_LIBRARY_PATH before execing zoom 189 # IPC breaks if the executable name does not end in 'zoom' 190 mv $out/opt/zoom/zoom $out/opt/zoom/.zoom 191 - makeWrapper $out/opt/zoom/.zoom $out/opt/zoom/zoom \ 192 --prefix LD_LIBRARY_PATH ":" ${libs} 193 194 rm $out/bin/zoom ··· 220 dontPatchELF = true; 221 222 passthru.updateScript = ./update.sh; 223 224 meta = with lib; { 225 homepage = "https://zoom.us/";
··· 40 pulseaudioSupport ? true, 41 libpulseaudio, 42 pulseaudio, 43 + callPackage, 44 }: 45 46 let ··· 51 # and often with different versions. We write them on three lines 52 # like this (rather than using {}) so that the updater script can 53 # find where to edit them. 54 + versions.aarch64-darwin = "6.3.6.47101"; 55 + versions.x86_64-darwin = "6.3.6.47101"; 56 + versions.x86_64-linux = "6.3.6.6315"; 57 58 srcs = { 59 aarch64-darwin = fetchurl { 60 url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64"; 61 name = "zoomusInstallerFull.pkg"; 62 + hash = "sha256-tqDf3Z5RRf4aRvtINWdM3oppZXbDdtihhPBHu4QxzDM="; 63 }; 64 x86_64-darwin = fetchurl { 65 url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg"; 66 + hash = "sha256-BZkBx5eZ3c3p9JIz+ChyJrGM12HwyNToSuS86f9QnF0="; 67 }; 68 x86_64-linux = fetchurl { 69 url = "https://zoom.us/client/${versions.x86_64-linux}/zoom_x86_64.pkg.tar.xz"; 70 + hash = "sha256-QJR8SsMtyYBvd5G+mEjEEISkJJukCYeHErKrgs1uDQc="; 71 }; 72 }; 73 ··· 123 coreutils 124 glib.dev 125 pciutils 126 + pipewire 127 procps 128 util-linux 129 ] ··· 181 substituteInPlace $out/share/applications/Zoom.desktop \ 182 --replace-fail "Exec=/usr/bin/zoom" "Exec=$out/bin/zoom" 183 184 + for i in aomhost zopen ZoomLauncher ZoomWebviewHost; do 185 if [ -f $out/opt/zoom/$i ]; then 186 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/$i 187 fi ··· 189 190 # ZoomLauncher sets LD_LIBRARY_PATH before execing zoom 191 # IPC breaks if the executable name does not end in 'zoom' 192 + # zoom binary does not like being touched by patchelf 193 + # => we call it indirectly via the dynamic linker 194 + # zoom binary inspects /proc/self/exe to find its data files 195 + # => we must place a copy (not symlink) of the linker in zoom's data dir 196 mv $out/opt/zoom/zoom $out/opt/zoom/.zoom 197 + cp "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/ld.so 198 + makeWrapper $out/opt/zoom/ld.so $out/opt/zoom/zoom \ 199 + --add-flags $out/opt/zoom/.zoom \ 200 --prefix LD_LIBRARY_PATH ":" ${libs} 201 202 rm $out/bin/zoom ··· 228 dontPatchELF = true; 229 230 passthru.updateScript = ./update.sh; 231 + passthru.tests.startwindow = callPackage ./test.nix { }; 232 233 meta = with lib; { 234 homepage = "https://zoom.us/";
+44
pkgs/by-name/zo/zoom-us/test.nix
···
··· 1 + { 2 + lib, 3 + xvfb-run, 4 + zoom-us, 5 + runCommand, 6 + writeShellApplication, 7 + xorg, 8 + }: 9 + 10 + let 11 + testScript = writeShellApplication { 12 + name = "zoom-us-test-script"; 13 + runtimeInputs = [ 14 + xorg.xwininfo 15 + zoom-us 16 + ]; 17 + text = '' 18 + function is_zoom_window_present { 19 + echo 20 + xwininfo -root -tree \ 21 + | sed 's/.*0x[0-9a-f]* \"\([^\"]*\)\".*/\1/; t; d' \ 22 + | tee window-names 23 + grep -q "Zoom Workplace" window-names 24 + } 25 + # don't let zoom eat all RAM, like it did 26 + # https://github.com/NixOS/nixpkgs/issues/371488 27 + prlimit --{as,data}=$((4*2**30)):$((4*2**30)) zoom-us & 28 + for _ in {0..900} ; do 29 + if is_zoom_window_present ; then 30 + break 31 + fi 32 + sleep 1 33 + done 34 + # if libraries are missing, the window still appears, 35 + # but disappears again immediatelly; check for that too: 36 + sleep 20 37 + is_zoom_window_present 38 + ''; 39 + }; 40 + in 41 + runCommand "zoom-us-test" { buildInputs = [ xvfb-run ]; } '' 42 + HOME=$PWD xvfb-run ${lib.getExe testScript} 43 + touch ${placeholder "out"} 44 + ''