Initial commit of a working Chucya flake?
This commit is contained in:
commit
76efcf6748
10 changed files with 4186 additions and 0 deletions
54
chuckya/update.sh
Executable file
54
chuckya/update.sh
Executable file
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env -S nix shell nixpkgs#coreutils nixpkgs#bundix nixpkgs#nix-prefetch-github nixpkgs#jq unstable#yarn-berry_4.yarn-berry-fetcher nixpkgs#git -c bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
echo "Retrieving latest TheEssem/mastodon commit..."
|
||||
commit_json="$(curl -SsL 'https://api.github.com/repos/TheEssem/mastodon/branches/main')"
|
||||
rev="$(jq -r '.commit.sha' <<<"$commit_json")"
|
||||
echo "Latest commit is $rev."
|
||||
|
||||
echo
|
||||
echo "Prefetching TheEssem/mastodon source via nix-prefetch-github..."
|
||||
prefetch_json="$(nix-prefetch-github TheEssem mastodon --rev "$rev")"
|
||||
hash="$(jq -r '.hash' <<<"$prefetch_json")"
|
||||
echo "Source hash is $hash."
|
||||
|
||||
echo
|
||||
echo "Cloning source into tempdir..."
|
||||
tmpdir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
|
||||
git clone --quiet --depth 1 --branch main https://github.com/TheEssem/mastodon.git "$tmpdir"
|
||||
pushd "$tmpdir" > /dev/null
|
||||
git checkout "$rev"
|
||||
popd > /dev/null
|
||||
|
||||
echo
|
||||
echo "Generating gemset.nix..."
|
||||
rm -f gemset.nix
|
||||
bundix --quiet --lockfile "$tmpdir/Gemfile.lock" --gemfile "$tmpdir/Gemfile"
|
||||
|
||||
echo
|
||||
echo "Generating missing-hashes.json for yarn..."
|
||||
rm -f missing-hashes.json
|
||||
yarn-berry-fetcher missing-hashes "$tmpdir/yarn.lock" > missing-hashes.json 2>/dev/null
|
||||
|
||||
echo
|
||||
echo "Prefetching yarn deps..."
|
||||
yarn_hash="$(yarn-berry-fetcher prefetch "$tmpdir/yarn.lock" ./missing-hashes.json 2>/dev/null)"
|
||||
|
||||
echo
|
||||
echo "Generating version_data.nix..."
|
||||
cat > version_data.nix <<EOF
|
||||
# This file was generated by update.sh.
|
||||
{
|
||||
rev = "$rev";
|
||||
hash = "$hash";
|
||||
yarnHash = "$yarn_hash";
|
||||
}
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "Done."
|
Loading…
Add table
Add a link
Reference in a new issue