about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/element/seshat/update.sh
blob: 6e7e75e66bce9c1c7ba2dc48d330ad4561eddb0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn nix-prefetch nix-prefetch-github

if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
  echo "Regenerates packaging data for the seshat package."
  echo "Usage: $0 [git release tag]"
  exit 1
fi

version="$1"

set -euo pipefail

if [ -z "$version" ]; then
  version="$(wget -O- "https://api.github.com/repos/matrix-org/seshat/tags" | jq -r '.[] | .name' | sort --version-sort | tail -1)"
fi

SRC="https://raw.githubusercontent.com/matrix-org/seshat/$version"

tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT

pushd $tmpdir
wget "$SRC/seshat-node/yarn.lock"
yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd

src_hash=$(nix-prefetch-github matrix-org seshat --rev ${version} | jq -r .hash)

cat > pin.json << EOF
{
  "version": "$version",
  "srcHash": "$src_hash",
  "yarnHash": "$yarn_hash",
  "cargoHash": "0000000000000000000000000000000000000000000000000000"
}
EOF

cargo_hash=$(nix-prefetch "{ sha256 }: (import ../../../../../.. {}).element-desktop.seshat.cargoDeps")

cat > pin.json << EOF
{
  "version": "$version",
  "srcHash": "$src_hash",
  "yarnHash": "$yarn_hash",
  "cargoHash": "$cargo_hash"
}
EOF