1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p coreutils curl jq git gnupg common-updater-scripts
5 # Fetch latest release, update derivation
6 scriptDir
=$
(cd "${BASH_SOURCE[0]%/*}" && pwd)
7 nixpkgs
=$
(realpath
"$scriptDir"/..
/..
/..
/..
)
9 oldVersion
=$
(nix-instantiate
--eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).teos.version" |
tr -d '"')
10 version
=$
(curl
-s --show-error "https://api.github.com/repos/talaia-labs/rust-teos/releases/latest" | jq
-r '.tag_name' |
tail -c +2)
12 if [[ $version == $oldVersion ]]; then
13 echo "Already at latest version $version"
16 echo "New version: $version"
18 tmpdir
=$
(mktemp
-d /tmp
/teos.XXX
)
20 trap 'rm -rf $tmpdir' EXIT
22 git clone
--depth 1 --branch "v${version}" -c advice.detachedHead
=false
'https://github.com/talaia-labs/rust-teos' "$repo"
23 git
-C "$repo" checkout
"tags/v${version}"
26 hashcheck
=$
(nix
hash path
"$repo")
28 (cd "$nixpkgs" && update-source-version teos
"$version" "$hashcheck")
29 sed -i 's|cargoHash = .*|cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";|' "${scriptDir}/default.nix"
31 echo "rust-teos: $oldVersion -> $version"