nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p coreutils curl gawk gnugrep gnused common-updater-scripts
3#shellcheck shell=bash
4
5set -eu -o pipefail
6
7update_arch() {
8 local arch="$1"
9 local system="$2"
10
11 local source_url
12 source_url="$(curl -L -I "https://orbstack.dev/download/stable/latest/$arch" | grep -i "location:" | awk '{print $2}' | tr -d '\r')"
13
14 local version
15 version="$(echo "$source_url" | grep -o '\([0-9]\+\.\)\{2\}[0-9]\+_[0-9]\+' | sed 's/_/-/')"
16
17 local hash
18 hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$(nix-prefetch-url --type sha256 "$source_url")")
19
20 update-source-version orbstack "$version" "$hash" --system="$system" --source-key="sources.$system" --ignore-same-version
21}
22
23update_arch "arm64" "aarch64-darwin"
24update_arch "amd64" "x86_64-darwin"