update mastodon

This commit is contained in:
Vivian 2025-05-29 13:53:41 +02:00
parent 2fe6723d1d
commit 82f22fb7e7
9 changed files with 164 additions and 176 deletions

View file

@ -1,28 +1,18 @@
#!/usr/bin/env -S nix shell nixpkgs#coreutils nixpkgs#bundix nixpkgs#nix-prefetch-github nixpkgs#jq -c bash
#!/usr/bin/env -S nix shell nixpkgs#coreutils nixpkgs#bundix nixpkgs#nix-prefetch-github nixpkgs#jq nixpkgs-unstable#yarn-berry_4.yarn-berry-fetcher -c bash
set -e
cd "$(dirname "$0")" # cd to the script's directory
echo "Retrieving latest glitch-soc commit..."
echo "Retrieving latest glitch-soc/mastodon commit..."
commit="$(curl -SsL 'https://api.github.com/repos/glitch-soc/mastodon/branches/main')"
rev="$(jq -r '.commit.sha' <<<"$commit")"
echo "Latest commit is $rev."
echo
echo "Prefetching source..."
hash="$(nix-prefetch-github glitch-soc mastodon --rev "$rev" | jq -r '.hash')"
echo
echo "Generating version_data.nix..."
cat > version_data.nix << EOF
# This file was generated with update.sh.
{
rev = "$rev";
hash = "$hash";
yarnHash = "";
}
EOF
echo "Prefetching glitch-soc/mastodon source..."
hash="$(nix-prefetch-github glitch-soc mastodon --rev $rev | jq -r '.hash')"
echo "Source hash is $hash."
echo
echo "Building source derivation..."
@ -36,7 +26,23 @@ bundix --quiet --lockfile $srcdir/Gemfile.lock --gemfile $srcdir/Gemfile
echo "" >> gemset.nix
echo
echo "Done."
echo "Generating missing yarn hashes file..."
yarn-berry-fetcher missing-hashes $srcdir/yarn.lock 2>/dev/null > ./missing-hashes.json
echo
echo "You'll have to manually enter the commit hash for the yarn deps from the error message when first trying to build the package."
echo "Prefetching yarn deps..."
yarn_hash="$(yarn-berry-fetcher prefetch "$srcdir/yarn.lock" ./missing-hashes.json 2>/dev/null)"
echo
echo "Generating version_data.nix..."
cat > version_data.nix << EOF
# This file was generated with update.sh.
{
rev = "$rev";
hash = "$hash";
yarnHash = "$yarn_hash";
}
EOF
echo
echo "Done."