zoom-us: simplify updater script
This uses pkgsCross to help the general update script find and update the various zoom versions for the various architectures. That way, we no longer need to calculate the source hashes in the update script. Credits: The commit at hand is inspired by https://github.com/NixOS/nixpkgs/blob/c656e00a21df6c42d6b57e9f8abf6cdf20e7b1ce/pkgs/by-name/ch/chataigne/update.sh#L24 (note: not merged into nixpkgs yet, so that link might disappear), after a friendly note by axelkar https://github.com/NixOS/nixpkgs/pull/429215#discussion_r2255114820 and a helpful hint by magistau https://github.com/NixOS/nixpkgs/pull/429215#discussion_r2506957507 Thanks to both of you!
This commit is contained in:
@@ -14,21 +14,10 @@ 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 --extra-experimental-features nix-command 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 --extra-experimental-features nix-command 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 --extra-experimental-features nix-command 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 --source-key=unpacked.src)
|
||||
(cd "$nixpkgs" && update-source-version --ignore-same-version --print-changes --version-key=versions.aarch64-darwin pkgsCross.aarch64-darwin.zoom-us "$version_aarch64_darwin")
|
||||
(cd "$nixpkgs" && update-source-version --ignore-same-version --print-changes --version-key=versions.x86_64-darwin pkgsCross.x86_64-darwin.zoom-us "$version_x86_64_darwin")
|
||||
(cd "$nixpkgs" && update-source-version --ignore-same-version --print-changes --version-key=versions.x86_64-linux pkgsCross.gnu64.zoom-us "$version_x86_64_linux" --source-key=unpacked.src)
|
||||
|
||||
echo >&2 "=== Done!"
|
||||
|
||||
Reference in New Issue
Block a user