about summary refs log tree commit diff
path: root/pkgs/servers/nitter
diff options
context:
space:
mode:
authorschnusch <schnusch@users.noreply.github.com>2022-11-24 00:25:36 +0100
committerschnusch <schnusch@users.noreply.github.com>2022-11-28 11:58:51 +0100
commitbe1187e30f67992c683487bf5ab74d10189c71d2 (patch)
treee2eb852ed99cb9560310d9496e9408dcf7abd485 /pkgs/servers/nitter
parent457b8403c159be5573de479c75e22b21e21b7daa (diff)
nitter: use nix-update in update script
Diffstat (limited to 'pkgs/servers/nitter')
-rwxr-xr-xpkgs/servers/nitter/update.sh21
1 files changed, 3 insertions, 18 deletions
diff --git a/pkgs/servers/nitter/update.sh b/pkgs/servers/nitter/update.sh
index e756eff5fb981..30405f34b22e8 100755
--- a/pkgs/servers/nitter/update.sh
+++ b/pkgs/servers/nitter/update.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env nix-shell
-#!nix-shell -i bash -p common-updater-scripts curl jq nix nix-prefetch-git patchutils
+#!nix-shell -i bash -p curl jq nix nix-update patchutils
 set -euo pipefail
 
 info() {
@@ -11,19 +11,9 @@ info() {
     printf "$@" >&2
 }
 
-nitter_old_version=$(nix-instantiate --eval --strict --json -A nitter.version . | jq -r .)
 nitter_old_rev=$(nix-instantiate --eval --strict --json -A nitter.src.rev . | jq -r .)
-today=$(LANG=C date -u +'%Y-%m-%d')
-
-# use latest commit before today, we should not call the version *today*
-# because there might still be commits coming
-# use the day of the latest commit we picked as version
-commit=$(curl -Sfs "https://api.github.com/repos/zedeus/nitter/compare/$nitter_old_rev~1...master" \
-    | jq '.commits | map(select(.commit.committer.date < $today) | {sha, date: .commit.committer.date}) | .[-1]' --arg today "$today")
-nitter_new_rev=$(jq -r '.sha' <<< "$commit")
-nitter_new_version="unstable-$(jq -r '.date[0:10]' <<< "$commit")"
-info "latest commit before $today: $nitter_new_rev ($(jq -r '.date' <<< "$commit"))"
-
+nix-update --version=branch --commit nitter
+nitter_new_rev=$(nix-instantiate --eval --strict --json -A nitter.src.rev . | jq -r .)
 if [ "$nitter_new_rev" = "$nitter_old_rev" ]; then
     info "nitter is up-to-date."
     exit
@@ -33,8 +23,3 @@ if curl -Sfs "https://github.com/zedeus/nitter/compare/$nitter_old_rev...$nitter
 | lsdiff | grep -Fxe 'a/nitter.nimble' -e 'b/nitter.nimble' > /dev/null; then
     info "nitter.nimble changed, some dependencies probably need updating."
 fi
-
-nitter_new_sha256=$(nix-prefetch-git --rev "$nitter_new_rev" "https://github.com/zedeus/nitter.git" | jq -r .sha256)
-update-source-version nitter "$nitter_new_version" "$nitter_new_sha256" --rev="$nitter_new_rev"
-git commit --all --verbose --message "nitter: $nitter_old_version -> $nitter_new_version"
-info "Updated nitter to $nitter_new_version."