tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
nitter: use nix-update in update script
schnusch
3 years ago
be1187e3
457b8403
+3
-18
1 changed file
expand all
collapse all
unified
split
pkgs
servers
nitter
update.sh
+3
-18
pkgs/servers/nitter/update.sh
···
1
1
#!/usr/bin/env nix-shell
2
2
-
#!nix-shell -i bash -p common-updater-scripts curl jq nix nix-prefetch-git patchutils
2
2
+
#!nix-shell -i bash -p curl jq nix nix-update patchutils
3
3
set -euo pipefail
4
4
5
5
info() {
···
11
11
printf "$@" >&2
12
12
}
13
13
14
14
-
nitter_old_version=$(nix-instantiate --eval --strict --json -A nitter.version . | jq -r .)
15
14
nitter_old_rev=$(nix-instantiate --eval --strict --json -A nitter.src.rev . | jq -r .)
16
16
-
today=$(LANG=C date -u +'%Y-%m-%d')
17
17
-
18
18
-
# use latest commit before today, we should not call the version *today*
19
19
-
# because there might still be commits coming
20
20
-
# use the day of the latest commit we picked as version
21
21
-
commit=$(curl -Sfs "https://api.github.com/repos/zedeus/nitter/compare/$nitter_old_rev~1...master" \
22
22
-
| jq '.commits | map(select(.commit.committer.date < $today) | {sha, date: .commit.committer.date}) | .[-1]' --arg today "$today")
23
23
-
nitter_new_rev=$(jq -r '.sha' <<< "$commit")
24
24
-
nitter_new_version="unstable-$(jq -r '.date[0:10]' <<< "$commit")"
25
25
-
info "latest commit before $today: $nitter_new_rev ($(jq -r '.date' <<< "$commit"))"
26
26
-
15
15
+
nix-update --version=branch --commit nitter
16
16
+
nitter_new_rev=$(nix-instantiate --eval --strict --json -A nitter.src.rev . | jq -r .)
27
17
if [ "$nitter_new_rev" = "$nitter_old_rev" ]; then
28
18
info "nitter is up-to-date."
29
19
exit
···
33
23
| lsdiff | grep -Fxe 'a/nitter.nimble' -e 'b/nitter.nimble' > /dev/null; then
34
24
info "nitter.nimble changed, some dependencies probably need updating."
35
25
fi
36
36
-
37
37
-
nitter_new_sha256=$(nix-prefetch-git --rev "$nitter_new_rev" "https://github.com/zedeus/nitter.git" | jq -r .sha256)
38
38
-
update-source-version nitter "$nitter_new_version" "$nitter_new_sha256" --rev="$nitter_new_rev"
39
39
-
git commit --all --verbose --message "nitter: $nitter_old_version -> $nitter_new_version"
40
40
-
info "Updated nitter to $nitter_new_version."