nixpkgs/pkgs/applications/networking/instant-messengers/zoom-us/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

200 lines
4.8 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, fetchurl
, pipewire
, makeWrapper
2022-04-05 02:42:04 +03:00
, xar
, cpio
2021-08-05 16:33:44 +03:00
# Dynamic libraries
, alsa-lib
, atk
2022-03-28 17:17:59 +03:00
, at-spi2-atk
, at-spi2-core
, cairo
2022-03-28 17:17:59 +03:00
, cups
, dbus
2022-03-28 17:17:59 +03:00
, expat
, libdrm
, libGL
, fontconfig
, freetype
, gtk3
, gdk-pixbuf
, glib
2022-03-28 17:17:59 +03:00
, mesa
, nspr
, nss
, pango
, wayland
, xorg
, libxkbcommon
2022-04-04 22:00:40 +03:00
, udev
, zlib
, libkrb5
2021-08-05 16:33:44 +03:00
# Runtime
, coreutils
, pciutils
, procps
, util-linux
2021-08-05 16:33:44 +03:00
, pulseaudioSupport ? true
, libpulseaudio
}:
let
2022-04-05 02:42:04 +03:00
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.
2023-01-20 16:49:07 +03:00
versions.aarch64-darwin = "5.13.6.14918";
versions.x86_64-darwin = "5.13.6.14918";
versions.x86_64-linux = "5.13.5.431";
2022-04-05 02:42:04 +03:00
srcs = {
2022-04-05 02:42:04 +03:00
aarch64-darwin = fetchurl {
url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64";
name = "zoomusInstallerFull.pkg";
2023-01-20 16:49:07 +03:00
hash = "sha256-QY9z1bTKtL32HE4XWnBIvCNmDF+3x5N9BdfqJA+24fA=";
2022-04-05 02:42:04 +03:00
};
x86_64-darwin = fetchurl {
url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg";
2023-01-20 16:49:07 +03:00
hash = "sha256-eSPKzxDPXCbME0eTTDlfsI5KM5qRm79JTtnGJvpiS98=";
2022-04-05 02:42:04 +03:00
};
x86_64-linux = fetchurl {
url = "https://zoom.us/client/${versions.x86_64-linux}/zoom_x86_64.pkg.tar.xz";
2023-01-20 16:49:07 +03:00
hash = "sha256-R0IMV/+R7AGFy/ZvNyyvIBv10t1x1U1X6jdHoo6UHKY=";
};
};
libs = lib.makeLibraryPath ([
# $ LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH:$PWD ldd zoom | grep 'not found'
alsa-lib
atk
2022-03-28 17:17:59 +03:00
at-spi2-atk
at-spi2-core
cairo
2022-03-28 17:17:59 +03:00
cups
dbus
2022-03-28 17:17:59 +03:00
expat
libdrm
libGL
pipewire
fontconfig
freetype
gtk3
gdk-pixbuf
glib
2022-03-28 17:17:59 +03:00
mesa
nspr
nss
pango
stdenv.cc.cc
wayland
xorg.libX11
xorg.libxcb
xorg.libXcomposite
2022-03-28 17:17:59 +03:00
xorg.libXdamage
xorg.libXext
libxkbcommon
2022-03-28 17:17:59 +03:00
xorg.libXrandr
xorg.libXrender
2022-03-28 17:17:59 +03:00
xorg.libxshmfence
xorg.xcbutilimage
xorg.xcbutilkeysyms
xorg.xcbutilrenderutil
xorg.xcbutilwm
xorg.libXfixes
xorg.libXtst
2022-04-04 22:00:40 +03:00
udev
zlib
libkrb5
] ++ lib.optional (pulseaudioSupport) libpulseaudio);
2021-08-05 16:33:44 +03:00
in
stdenv.mkDerivation rec {
pname = "zoom";
version = versions.${system} or throwSystem;
2021-08-05 16:33:44 +03:00
2022-04-26 18:38:13 +03:00
src = srcs.${system} or throwSystem;
2022-04-26 18:34:44 +03:00
dontUnpack = stdenv.isLinux;
2022-04-05 02:42:04 +03:00
unpackPhase = lib.optionalString stdenv.isDarwin ''
xar -xf $src
zcat < zoomus.pkg/Payload | cpio -i
'';
nativeBuildInputs = [
makeWrapper
2022-04-05 02:42:04 +03:00
]
++ lib.optionals stdenv.isDarwin [
xar
cpio
2019-07-29 23:34:40 +03:00
];
installPhase = ''
runHook preInstall
${rec {
aarch64-darwin = ''
2022-04-28 02:47:23 +03:00
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/
'';
2022-04-26 18:38:13 +03:00
}.${system} or throwSystem}
runHook postInstall
'';
2022-04-05 02:42:04 +03:00
postFixup = lib.optionalString stdenv.isLinux ''
# Desktop File
substituteInPlace $out/share/applications/Zoom.desktop \
--replace "Exec=/usr/bin/zoom" "Exec=$out/bin/zoom"
2022-08-29 02:28:00 +03:00
for i in aomhost zopen zoom ZoomLauncher; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/$i
done
2019-07-29 23:34:40 +03:00
# 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 compatiblity: we used to call it zoom-us
ln -s $out/bin/{zoom,zoom-us}
'';
# already done
dontPatchELF = true;
passthru.updateScript = ./update.sh;
2021-08-05 16:33:44 +03:00
meta = with lib; {
homepage = "https://zoom.us/";
description = "zoom.us video conferencing application";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
2021-08-05 16:33:44 +03:00
license = licenses.unfree;
platforms = builtins.attrNames srcs;
2021-08-05 16:33:44 +03:00
maintainers = with maintainers; [ danbst tadfisher doronbehar ];
};
}