Loading pkgs/by-name/zo/zoom-us/package.nix +44 −103 Original line number Diff line number Diff line Loading @@ -2,9 +2,6 @@ stdenv, lib, fetchurl, makeWrapper, xar, cpio, pulseaudioSupport ? true, xdgDesktopPortalSupport ? true, callPackage, Loading @@ -12,90 +9,39 @@ }: 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.4.6.53970"; versions.x86_64-darwin = "6.4.6.53970"; versions.x86_64-linux = "6.4.6.1370"; unpacked = stdenv.mkDerivation (finalAttrs: { pname = "zoom"; version = "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"; src = fetchurl { url = "https://zoom.us/client/${finalAttrs.version}/zoom_x86_64.pkg.tar.xz"; hash = "sha256-Y+8garSqDcKLCVv1cTiqGEfrGKpK3UoXIq8X4E8CF+8="; }; }; unpacked = stdenv.mkDerivation { pname = "zoom"; version = versions.${system} or throwSystem; src = srcs.${system} or throwSystem; dontUnpack = stdenv.hostPlatform.isLinux; unpackPhase = lib.optionalString stdenv.hostPlatform.isDarwin '' xar -xf $src zcat < zoomus.pkg/Payload | cpio -i ''; dontUnpack = true; # Note: In order to uncover missing libraries # on x86_64-linux, add "pkgs" to this file's arguments # Note: In order to uncover missing libraries, # add "pkgs" to this file's arguments # (at the top of this file), then add these attributes here: # > buildInputs = linuxGetDependencies pkgs; # > dontAutoPatchelf = true; # > dontWrapQtApps = true; # > nativeBuildInputs = [ pkgs.autoPatchelfHook ]; # > preFixup = '' # > addAutoPatchelfSearchPath $out/opt/zoom # > 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`: # `autoPatchelfHook` will report missing library files. nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper 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.hostPlatform.isDarwin '' makeWrapper $out/Applications/zoom.us.app/Contents/MacOS/zoom.us $out/bin/zoom ''; dontPatchELF = true; passthru.updateScript = ./update.sh; Loading @@ -107,18 +53,13 @@ let description = "zoom.us video conferencing application"; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = lib.licenses.unfree; platforms = builtins.attrNames srcs; platforms = [ "x86_64-linux" ]; maintainers = with lib.maintainers; [ danbst tadfisher ]; mainProgram = "zoom"; }; }; packages.aarch64-darwin = unpacked; packages.x86_64-darwin = unpacked; # linux definitions }); linuxGetDependencies = pkgs: Loading Loading @@ -191,13 +132,15 @@ let pkgs.xdg-desktop-portal-xapp ]; in # 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 { buildFHSEnv rec { pname = "zoom"; # Will also be the program's name! version = versions.${system} or throwSystem; inherit (unpacked) version; targetPkgs = pkgs: (linuxGetDependencies pkgs) ++ [ unpacked ]; extraPreBwrapCmds = "unset QT_PLUGIN_PATH"; Loading @@ -217,9 +160,7 @@ let passthru = unpacked.passthru // { inherit unpacked; }; inherit (unpacked) meta; meta = unpacked.meta // { mainProgram = pname; }; in packages.${system} or throwSystem } pkgs/by-name/zo/zoom-us/update.sh +1 −29 Original line number Diff line number Diff line Loading @@ -3,32 +3,4 @@ set -eu -o pipefail 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!" update-source-version zoom-us $(curl -Ls 'https://zoom.us/rest/download?os=linux' | jq -r .result.downloadVO.zoom.version) --source-key=unpacked.src Loading
pkgs/by-name/zo/zoom-us/package.nix +44 −103 Original line number Diff line number Diff line Loading @@ -2,9 +2,6 @@ stdenv, lib, fetchurl, makeWrapper, xar, cpio, pulseaudioSupport ? true, xdgDesktopPortalSupport ? true, callPackage, Loading @@ -12,90 +9,39 @@ }: 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.4.6.53970"; versions.x86_64-darwin = "6.4.6.53970"; versions.x86_64-linux = "6.4.6.1370"; unpacked = stdenv.mkDerivation (finalAttrs: { pname = "zoom"; version = "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"; src = fetchurl { url = "https://zoom.us/client/${finalAttrs.version}/zoom_x86_64.pkg.tar.xz"; hash = "sha256-Y+8garSqDcKLCVv1cTiqGEfrGKpK3UoXIq8X4E8CF+8="; }; }; unpacked = stdenv.mkDerivation { pname = "zoom"; version = versions.${system} or throwSystem; src = srcs.${system} or throwSystem; dontUnpack = stdenv.hostPlatform.isLinux; unpackPhase = lib.optionalString stdenv.hostPlatform.isDarwin '' xar -xf $src zcat < zoomus.pkg/Payload | cpio -i ''; dontUnpack = true; # Note: In order to uncover missing libraries # on x86_64-linux, add "pkgs" to this file's arguments # Note: In order to uncover missing libraries, # add "pkgs" to this file's arguments # (at the top of this file), then add these attributes here: # > buildInputs = linuxGetDependencies pkgs; # > dontAutoPatchelf = true; # > dontWrapQtApps = true; # > nativeBuildInputs = [ pkgs.autoPatchelfHook ]; # > preFixup = '' # > addAutoPatchelfSearchPath $out/opt/zoom # > 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`: # `autoPatchelfHook` will report missing library files. nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper 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.hostPlatform.isDarwin '' makeWrapper $out/Applications/zoom.us.app/Contents/MacOS/zoom.us $out/bin/zoom ''; dontPatchELF = true; passthru.updateScript = ./update.sh; Loading @@ -107,18 +53,13 @@ let description = "zoom.us video conferencing application"; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = lib.licenses.unfree; platforms = builtins.attrNames srcs; platforms = [ "x86_64-linux" ]; maintainers = with lib.maintainers; [ danbst tadfisher ]; mainProgram = "zoom"; }; }; packages.aarch64-darwin = unpacked; packages.x86_64-darwin = unpacked; # linux definitions }); linuxGetDependencies = pkgs: Loading Loading @@ -191,13 +132,15 @@ let pkgs.xdg-desktop-portal-xapp ]; in # 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 { buildFHSEnv rec { pname = "zoom"; # Will also be the program's name! version = versions.${system} or throwSystem; inherit (unpacked) version; targetPkgs = pkgs: (linuxGetDependencies pkgs) ++ [ unpacked ]; extraPreBwrapCmds = "unset QT_PLUGIN_PATH"; Loading @@ -217,9 +160,7 @@ let passthru = unpacked.passthru // { inherit unpacked; }; inherit (unpacked) meta; meta = unpacked.meta // { mainProgram = pname; }; in packages.${system} or throwSystem }
pkgs/by-name/zo/zoom-us/update.sh +1 −29 Original line number Diff line number Diff line Loading @@ -3,32 +3,4 @@ set -eu -o pipefail 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!" update-source-version zoom-us $(curl -Ls 'https://zoom.us/rest/download?os=linux' | jq -r .result.downloadVO.zoom.version) --source-key=unpacked.src