mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
Revert "zoom-us: drop Darwin support"
This reverts commit 27f0cbcf54
.
Darwin support is still desired and there is nothing wrong in supporting
it. MacOS doesn't need FHS hack.
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
parent
7a2622e2c0
commit
a9ebf4d4cd
2 changed files with 132 additions and 45 deletions
|
@ -2,6 +2,9 @@
|
||||||
stdenv,
|
stdenv,
|
||||||
lib,
|
lib,
|
||||||
fetchurl,
|
fetchurl,
|
||||||
|
makeWrapper,
|
||||||
|
xar,
|
||||||
|
cpio,
|
||||||
pulseaudioSupport ? true,
|
pulseaudioSupport ? true,
|
||||||
xdgDesktopPortalSupport ? true,
|
xdgDesktopPortalSupport ? true,
|
||||||
callPackage,
|
callPackage,
|
||||||
|
@ -9,39 +12,90 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
unpacked = stdenv.mkDerivation (finalAttrs: {
|
inherit (stdenv.hostPlatform) system;
|
||||||
pname = "zoom";
|
throwSystem = throw "Unsupported system: ${system}";
|
||||||
version = "6.4.6.1370";
|
|
||||||
|
|
||||||
src = fetchurl {
|
# Zoom versions are released at different times for each platform
|
||||||
url = "https://zoom.us/client/${finalAttrs.version}/zoom_x86_64.pkg.tar.xz";
|
# 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.4.6.53970";
|
||||||
|
versions.x86_64-darwin = "6.4.6.53970";
|
||||||
|
versions.x86_64-linux = "6.4.6.1370";
|
||||||
|
|
||||||
|
srcs = {
|
||||||
|
aarch64-darwin = fetchurl {
|
||||||
|
url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64";
|
||||||
|
name = "zoomusInstallerFull.pkg";
|
||||||
|
hash = "sha256-yNsiFZNte4432d8DUyDhPUOVbLul7gUdvr+3qK/Y+tk=";
|
||||||
|
};
|
||||||
|
x86_64-darwin = fetchurl {
|
||||||
|
url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg";
|
||||||
|
hash = "sha256-Ut93qQFFN0d58wXD5r8u0B17HbihFg3FgY3a1L8nsIA=";
|
||||||
|
};
|
||||||
|
x86_64-linux = fetchurl {
|
||||||
|
url = "https://zoom.us/client/${versions.x86_64-linux}/zoom_x86_64.pkg.tar.xz";
|
||||||
hash = "sha256-Y+8garSqDcKLCVv1cTiqGEfrGKpK3UoXIq8X4E8CF+8=";
|
hash = "sha256-Y+8garSqDcKLCVv1cTiqGEfrGKpK3UoXIq8X4E8CF+8=";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
dontUnpack = true;
|
unpacked = stdenv.mkDerivation {
|
||||||
|
pname = "zoom";
|
||||||
|
version = versions.${system} or throwSystem;
|
||||||
|
|
||||||
# Note: In order to uncover missing libraries,
|
src = srcs.${system} or throwSystem;
|
||||||
# add "pkgs" to this file's arguments
|
|
||||||
|
dontUnpack = stdenv.hostPlatform.isLinux;
|
||||||
|
unpackPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||||
|
xar -xf $src
|
||||||
|
zcat < zoomus.pkg/Payload | cpio -i
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Note: In order to uncover missing libraries
|
||||||
|
# on x86_64-linux, add "pkgs" to this file's arguments
|
||||||
# (at the top of this file), then add these attributes here:
|
# (at the top of this file), then add these attributes here:
|
||||||
# > buildInputs = linuxGetDependencies pkgs;
|
# > buildInputs = linuxGetDependencies pkgs;
|
||||||
# > dontAutoPatchelf = true;
|
# > dontAutoPatchelf = true;
|
||||||
# > dontWrapQtApps = true;
|
# > dontWrapQtApps = true;
|
||||||
# > nativeBuildInputs = [ pkgs.autoPatchelfHook ];
|
|
||||||
# > preFixup = ''
|
# > preFixup = ''
|
||||||
# > addAutoPatchelfSearchPath $out/opt/zoom
|
# > addAutoPatchelfSearchPath $out/opt/zoom
|
||||||
# > autoPatchelf $out/opt/zoom/{cef,Qt,*.so*,aomhost,zoom,zopen,ZoomLauncher,ZoomWebviewHost}
|
# > autoPatchelf $out/opt/zoom/{cef,Qt,*.so*,aomhost,zoom,zopen,ZoomLauncher,ZoomWebviewHost}
|
||||||
# > '';
|
# > '';
|
||||||
|
# ...and finally "pkgs.autoPatchelfHook"
|
||||||
|
# to `nativeBuildInputs` right below.
|
||||||
# Then build `zoom-us.unpacked`:
|
# Then build `zoom-us.unpacked`:
|
||||||
# `autoPatchelfHook` will report missing library files.
|
# `autoPatchelfHook` will report missing library files.
|
||||||
|
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||||
|
makeWrapper
|
||||||
|
xar
|
||||||
|
cpio
|
||||||
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir $out
|
${
|
||||||
tar -C $out -xf $src
|
rec {
|
||||||
mv $out/usr/* $out/
|
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
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||||
|
makeWrapper $out/Applications/zoom.us.app/Contents/MacOS/zoom.us $out/bin/zoom
|
||||||
|
'';
|
||||||
|
|
||||||
dontPatchELF = true;
|
dontPatchELF = true;
|
||||||
|
|
||||||
passthru.updateScript = ./update.sh;
|
passthru.updateScript = ./update.sh;
|
||||||
|
@ -53,13 +107,18 @@ let
|
||||||
description = "zoom.us video conferencing application";
|
description = "zoom.us video conferencing application";
|
||||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||||
license = lib.licenses.unfree;
|
license = lib.licenses.unfree;
|
||||||
platforms = [ "x86_64-linux" ];
|
platforms = builtins.attrNames srcs;
|
||||||
maintainers = with lib.maintainers; [
|
maintainers = with lib.maintainers; [
|
||||||
danbst
|
danbst
|
||||||
tadfisher
|
tadfisher
|
||||||
];
|
];
|
||||||
|
mainProgram = "zoom";
|
||||||
};
|
};
|
||||||
});
|
};
|
||||||
|
packages.aarch64-darwin = unpacked;
|
||||||
|
packages.x86_64-darwin = unpacked;
|
||||||
|
|
||||||
|
# linux definitions
|
||||||
|
|
||||||
linuxGetDependencies =
|
linuxGetDependencies =
|
||||||
pkgs:
|
pkgs:
|
||||||
|
@ -132,35 +191,35 @@ let
|
||||||
pkgs.xdg-desktop-portal-xapp
|
pkgs.xdg-desktop-portal-xapp
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# We add the `unpacked` zoom archive to the FHS env
|
||||||
|
# and also bind-mount its `/opt` directory.
|
||||||
|
# This should assist Zoom in finding all its
|
||||||
|
# files in the places where it expects them to be.
|
||||||
|
packages.x86_64-linux = buildFHSEnv {
|
||||||
|
pname = "zoom"; # Will also be the program's name!
|
||||||
|
version = versions.${system} or throwSystem;
|
||||||
|
|
||||||
|
targetPkgs = pkgs: (linuxGetDependencies pkgs) ++ [ unpacked ];
|
||||||
|
extraPreBwrapCmds = "unset QT_PLUGIN_PATH";
|
||||||
|
extraBwrapArgs = [ "--ro-bind ${unpacked}/opt /opt" ];
|
||||||
|
runScript = "/opt/zoom/ZoomLauncher";
|
||||||
|
|
||||||
|
extraInstallCommands = ''
|
||||||
|
cp -Rt $out/ ${unpacked}/share
|
||||||
|
substituteInPlace \
|
||||||
|
$out/share/applications/Zoom.desktop \
|
||||||
|
--replace-fail Exec={/usr/bin/,}zoom
|
||||||
|
|
||||||
|
# Backwards compatibility: we used to call it zoom-us
|
||||||
|
ln -s $out/bin/{zoom,zoom-us}
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = unpacked.passthru // {
|
||||||
|
inherit unpacked;
|
||||||
|
};
|
||||||
|
inherit (unpacked) meta;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
# We add the `unpacked` zoom archive to the FHS env
|
packages.${system} or throwSystem
|
||||||
# and also bind-mount its `/opt` directory.
|
|
||||||
# This should assist Zoom in finding all its
|
|
||||||
# files in the places where it expects them to be.
|
|
||||||
buildFHSEnv rec {
|
|
||||||
pname = "zoom"; # Will also be the program's name!
|
|
||||||
inherit (unpacked) version;
|
|
||||||
|
|
||||||
targetPkgs = pkgs: (linuxGetDependencies pkgs) ++ [ unpacked ];
|
|
||||||
extraPreBwrapCmds = "unset QT_PLUGIN_PATH";
|
|
||||||
extraBwrapArgs = [ "--ro-bind ${unpacked}/opt /opt" ];
|
|
||||||
runScript = "/opt/zoom/ZoomLauncher";
|
|
||||||
|
|
||||||
extraInstallCommands = ''
|
|
||||||
cp -Rt $out/ ${unpacked}/share
|
|
||||||
substituteInPlace \
|
|
||||||
$out/share/applications/Zoom.desktop \
|
|
||||||
--replace-fail Exec={/usr/bin/,}zoom
|
|
||||||
|
|
||||||
# Backwards compatibility: we used to call it zoom-us
|
|
||||||
ln -s $out/bin/{zoom,zoom-us}
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = unpacked.passthru // {
|
|
||||||
inherit unpacked;
|
|
||||||
};
|
|
||||||
meta = unpacked.meta // {
|
|
||||||
mainProgram = pname;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,4 +3,32 @@
|
||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
update-source-version zoom-us $(curl -Ls 'https://zoom.us/rest/download?os=linux' | jq -r .result.downloadVO.zoom.version) --source-key=unpacked.src
|
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||||
|
nixpkgs=$(realpath "$scriptDir"/../../../..)
|
||||||
|
|
||||||
|
echo >&2 "=== Obtaining version data from https://zoom.us/rest/download ..."
|
||||||
|
linux_data=$(curl -Ls 'https://zoom.us/rest/download?os=linux' | jq .result.downloadVO)
|
||||||
|
mac_data=$(curl -Ls 'https://zoom.us/rest/download?os=mac' | jq .result.downloadVO)
|
||||||
|
|
||||||
|
version_aarch64_darwin=$(jq -r .zoomArm64.version <<<"$mac_data")
|
||||||
|
version_x86_64_darwin=$(jq -r .zoom.version <<<"$mac_data")
|
||||||
|
version_x86_64_linux=$(jq -r .zoom.version <<<"$linux_data")
|
||||||
|
|
||||||
|
echo >&2 "=== Downloading packages and computing hashes..."
|
||||||
|
# We precalculate the hashes before calling update-source-version
|
||||||
|
# because it attempts to calculate each architecture's package's hash
|
||||||
|
# by running `nix-build --system <architecture> -A zoom-us.src` which
|
||||||
|
# causes cross compiling headaches; using nix-prefetch-url with
|
||||||
|
# hard-coded URLs is simpler. Keep these URLs in sync with the ones
|
||||||
|
# in package.nix where `srcs` is defined.
|
||||||
|
hash_aarch64_darwin=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "https://zoom.us/client/${version_aarch64_darwin}/zoomusInstallerFull.pkg?archType=arm64"))
|
||||||
|
hash_x86_64_darwin=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "https://zoom.us/client/${version_x86_64_darwin}/zoomusInstallerFull.pkg"))
|
||||||
|
hash_x86_64_linux=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "https://zoom.us/client/${version_x86_64_linux}/zoom_x86_64.pkg.tar.xz"))
|
||||||
|
|
||||||
|
echo >&2 "=== Updating package.nix ..."
|
||||||
|
# update-source-version expects to be at the root of nixpkgs
|
||||||
|
(cd "$nixpkgs" && update-source-version zoom-us "$version_aarch64_darwin" $hash_aarch64_darwin --system=aarch64-darwin --version-key=versions.aarch64-darwin)
|
||||||
|
(cd "$nixpkgs" && update-source-version zoom-us "$version_x86_64_darwin" $hash_x86_64_darwin --system=x86_64-darwin --version-key=versions.x86_64-darwin)
|
||||||
|
(cd "$nixpkgs" && update-source-version zoom-us "$version_x86_64_linux" $hash_x86_64_linux --system=x86_64-linux --version-key=versions.x86_64-linux)
|
||||||
|
|
||||||
|
echo >&2 "=== Done!"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue