tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
teos: add update script
Otto Sabart
2 years ago
511d699e
2345d940
+36
2 changed files
expand all
collapse all
unified
split
pkgs
applications
blockchains
teos
default.nix
update.sh
+5
pkgs/applications/blockchains/teos/default.nix
···
24
24
license = licenses.mit;
25
25
maintainers = with maintainers; [ seberm ];
26
26
};
27
27
+
updateScript = ./update.sh;
27
28
in
28
29
{
29
30
teos = rustPlatform.buildRustPackage {
···
42
43
buildInputs = lib.optionals stdenv.isDarwin [
43
44
darwin.apple_sdk.frameworks.Security
44
45
];
46
46
+
47
47
+
passthru.updateScript = updateScript;
45
48
46
49
__darwinAllowLocalNetworking = true;
47
50
···
69
72
] ++ lib.optionals stdenv.isDarwin [
70
73
darwin.apple_sdk.frameworks.SystemConfiguration
71
74
];
75
75
+
76
76
+
passthru.updateScript = updateScript;
72
77
73
78
__darwinAllowLocalNetworking = true;
74
79
+31
pkgs/applications/blockchains/teos/update.sh
···
1
1
+
#!/usr/bin/env nix-shell
2
2
+
#!nix-shell -i bash -p coreutils curl jq git gnupg common-updater-scripts
3
3
+
set -euo pipefail
4
4
+
5
5
+
# Fetch latest release, update derivation
6
6
+
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
7
7
+
nixpkgs=$(realpath "$scriptDir"/../../../..)
8
8
+
9
9
+
oldVersion=$(nix-instantiate --eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).teos.version" | tr -d '"')
10
10
+
version=$(curl -s --show-error "https://api.github.com/repos/talaia-labs/rust-teos/releases/latest" | jq -r '.tag_name' | tail -c +2)
11
11
+
12
12
+
if [[ $version == $oldVersion ]]; then
13
13
+
echo "Already at latest version $version"
14
14
+
exit 0
15
15
+
fi
16
16
+
echo "New version: $version"
17
17
+
18
18
+
tmpdir=$(mktemp -d /tmp/teos.XXX)
19
19
+
repo="${tmpdir}/repo"
20
20
+
trap 'rm -rf $tmpdir' EXIT
21
21
+
22
22
+
git clone --depth 1 --branch "v${version}" -c advice.detachedHead=false 'https://github.com/talaia-labs/rust-teos' "$repo"
23
23
+
git -C "$repo" checkout "tags/v${version}"
24
24
+
25
25
+
rm -rf "${repo}/.git"
26
26
+
hashcheck=$(nix hash path "$repo")
27
27
+
28
28
+
(cd "$nixpkgs" && update-source-version teos "$version" "$hashcheck")
29
29
+
sed -i 's|cargoHash = .*|cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";|' "${scriptDir}/default.nix"
30
30
+
echo
31
31
+
echo "rust-teos: $oldVersion -> $version"