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

137 lines
4.1 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, mkDerivation, autoPatchelfHook, bash
2019-08-01 01:32:54 +00:00
, fetchFromGitHub
# Dynamic libraries
, dbus, glib, libGL, libX11, libXfixes, libuuid, libxcb, qtbase, qtdeclarative
, qtgraphicaleffects, qtimageformats, qtlocation, qtquickcontrols
, qtquickcontrols2, qtscript, qtsvg , qttools, qtwayland, qtwebchannel
, qtwebengine
# Runtime
2020-11-24 15:29:28 +00:00
, coreutils, faac, pciutils, procps, util-linux
, pulseaudioSupport ? true, libpulseaudio ? null
2020-11-12 01:10:14 +00:00
, alsaSupport ? stdenv.isLinux, alsaLib ? null
}:
assert pulseaudioSupport -> libpulseaudio != null;
let
inherit (stdenv.lib) concatStringsSep makeBinPath optional;
version = "5.4.53350.1027";
srcs = {
x86_64-linux = fetchurl {
url = "https://zoom.us/client/${version}/zoom_x86_64.tar.xz";
sha256 = "11va3px42y81bwy10mxm7mk0kf2sni9gwb422pq9djck2dgchw5x";
};
};
# Used for icons, appdata, and desktop file.
desktopIntegration = fetchFromGitHub {
owner = "flathub";
repo = "us.zoom.Zoom";
rev = "25e14f8141cdc682b4f7d9ebe15608619f5a19f2";
sha256 = "0w3pdd5484r3nsb4iahi37jdlm37vm1053sb8k2zlqb9s554zjwp";
};
2019-07-29 20:34:40 +00:00
in mkDerivation {
2019-08-13 21:52:01 +00:00
pname = "zoom-us";
inherit version;
src = srcs.${stdenv.hostPlatform.system};
2019-08-01 01:32:54 +00:00
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
dbus glib libGL libX11 libXfixes libuuid libxcb faac qtbase
qtdeclarative qtgraphicaleffects qtlocation qtquickcontrols qtquickcontrols2
qtscript qtwebchannel qtwebengine qtimageformats qtsvg qttools qtwayland
2019-07-29 20:34:40 +00:00
];
2020-11-12 01:10:14 +00:00
runtimeDependencies = optional pulseaudioSupport libpulseaudio
++ optional alsaSupport alsaLib;
installPhase =
let
files = concatStringsSep " " [
"*.pcm"
"*.png"
"ZoomLauncher"
"config-dump.sh"
"timezones"
"translations"
"version.txt"
"zcacert.pem"
"zoom"
"zoom.sh"
"zopen"
];
in ''
runHook preInstall
2019-07-29 20:34:40 +00:00
mkdir -p $out/{bin,share/zoom-us}
2019-07-29 20:34:40 +00:00
cp -ar ${files} $out/share/zoom-us
# TODO Patch this somehow; tries to dlopen './libturbojpeg.so' from cwd
cp libturbojpeg.so $out/share/zoom-us/libturbojpeg.so
# Again, requires faac with a nonstandard filename.
ln -s $(readlink -e "${faac}/lib/libfaac.so") $out/share/zoom-us/libfaac1.so
runHook postInstall
'';
postInstall = ''
mkdir -p $out/share/{applications,appdata,icons}
# Desktop File
cp ${desktopIntegration}/us.zoom.Zoom.desktop $out/share/applications
substituteInPlace $out/share/applications/us.zoom.Zoom.desktop \
--replace "Exec=zoom" "Exec=$out/bin/zoom-us"
# Appdata
cp ${desktopIntegration}/us.zoom.Zoom.appdata.xml $out/share/appdata
# Icons
for icon_size in 64 96 128 256; do
path=$icon_size'x'$icon_size
icon=${desktopIntegration}/us.zoom.Zoom.$icon_size.png
mkdir -p $out/share/icons/hicolor/$path/apps
cp $icon $out/share/icons/hicolor/$path/apps/us.zoom.Zoom.png
done
2019-07-29 20:34:40 +00:00
'';
# $out/share/zoom-us isn't in auto-wrap directories list, need manual wrapping
dontWrapQtApps = true;
2019-07-29 20:34:40 +00:00
qtWrapperArgs = [
2020-11-24 15:29:28 +00:00
''--prefix PATH : ${makeBinPath [ coreutils glib.dev pciutils procps qttools.dev util-linux ]}''
# --run "cd ${placeholder "out"}/share/zoom-us"
# ^^ unfortunately, breaks run arg into multiple array elements, due to
# some bad array propagation. We'll do that in bash below
2019-07-29 20:34:40 +00:00
];
2018-03-16 19:03:15 +00:00
postFixup = ''
# 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:
qtWrapperArgs+=( --run "cd ${placeholder "out"}/share/zoom-us" )
for app in ZoomLauncher zopen zoom; do
wrapQtApp $out/share/zoom-us/$app
done
ln -s $out/share/zoom-us/ZoomLauncher $out/bin/zoom-us
'';
passthru.updateScript = ./update.sh;
meta = {
homepage = "https://zoom.us/";
description = "zoom.us video conferencing application";
license = stdenv.lib.licenses.unfree;
platforms = builtins.attrNames srcs;
maintainers = with stdenv.lib.maintainers; [ danbst tadfisher doronbehar ];
};
}