1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p common-updater-scripts curl jq
6 scriptDir
=$
(cd "${BASH_SOURCE[0]%/*}" && pwd)
7 nixpkgs
=$
(realpath
"$scriptDir"/..
/..
/..
/..
)
9 echo >&2 "=== Obtaining version data from https://zoom.us/rest/download ..."
10 linux_data
=$
(curl
-Ls 'https://zoom.us/rest/download?os=linux' | jq .result.downloadVO
)
11 mac_data
=$
(curl
-Ls 'https://zoom.us/rest/download?os=mac' | jq .result.downloadVO
)
13 version_aarch64_darwin
=$
(jq
-r .zoomArm64.version
<<<"$mac_data")
14 version_x86_64_darwin
=$
(jq
-r .zoom.version
<<<"$mac_data")
15 version_x86_64_linux
=$
(jq
-r .zoom.version
<<<"$linux_data")
17 echo >&2 "=== Downloading packages and computing hashes..."
18 # We precalculate the hashes before calling update-source-version
19 # because it attempts to calculate each architecture's package's hash
20 # by running `nix-build --system <architecture> -A zoom-us.src` which
21 # causes cross compiling headaches; using nix-prefetch-url with
22 # hard-coded URLs is simpler. Keep these URLs in sync with the ones
23 # in package.nix where `srcs` is defined.
24 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"))
25 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"))
26 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"))
28 echo >&2 "=== Updating package.nix ..."
29 # update-source-version expects to be at the root of nixpkgs
30 (cd "$nixpkgs" && update-source-version zoom-us
"$version_aarch64_darwin" $hash_aarch64_darwin --system=aarch64-darwin
--version-key=versions.aarch64-darwin
)
31 (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
)
32 (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
)