2020-04-09 23:23:56 +01:00
|
|
|
#!/usr/bin/env nix-shell
|
2020-04-11 09:54:26 +01:00
|
|
|
#! nix-shell -i bash -p nix-prefetch jq
|
2020-04-09 23:23:56 +01:00
|
|
|
|
2020-04-11 09:54:26 +01:00
|
|
|
latest_release=$(curl --silent https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest)
|
|
|
|
version=$(jq -r '.tag_name' <<<"$latest_release")
|
2020-04-09 23:23:56 +01:00
|
|
|
|
|
|
|
dirname="$(dirname "$0")"
|
2023-03-02 08:16:55 +00:00
|
|
|
echo \""${version#v}"\" >"$dirname/version-new.nix"
|
|
|
|
if diff -q "$dirname/version-new.nix" "$dirname/version.nix"; then
|
|
|
|
echo No new version available, current: $version
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo Updated to version "$version"
|
|
|
|
mv "$dirname/version-new.nix" "$dirname/version.nix"
|
|
|
|
fi
|
2020-04-09 23:23:56 +01:00
|
|
|
|
|
|
|
printf '{\n' > "$dirname/shas.nix"
|
|
|
|
|
2020-04-11 09:54:26 +01:00
|
|
|
while
|
|
|
|
read -r name
|
|
|
|
read -r url
|
|
|
|
do
|
2023-05-13 23:31:13 +01:00
|
|
|
printf ' "%s" = "%s";\n' "${name%%.*}" "$(nix-prefetch-url "$url")" >>"$dirname/shas.nix"
|
|
|
|
done < <(jq -r '.assets[] | select(.name | test("xz")) | .name, .browser_download_url' <<<"$latest_release")
|
2020-04-09 23:23:56 +01:00
|
|
|
|
|
|
|
printf '}\n' >> "$dirname/shas.nix"
|