Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nerdfonts: update.sh: use releases api to generate shas #84979

Merged
merged 1 commit into from Apr 11, 2020

Conversation

doronbehar
Copy link
Contributor

Motivation for this change

Fix #84947 and make sure issues like these won't arise again. /cc @worldofpeace @albakham .

Things done
  • Improved update.sh to parse the HTML in order to fetch the list of fonts.
  • Updated shas.nix.
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@marsam
Copy link
Contributor

marsam commented Apr 11, 2020

I think you could write update.sh as:

#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch jq

latest_release=$(curl https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest)
version=$(jq -r '.tag_name' <<<"$latest_release")

dirname="$(dirname "$0")"
echo \""${version#v}"\" >"$dirname/version.nix"

echo Using version "$version"

printf '{\n' > "$dirname/shas.nix"

while
  read -r name
  read -r url
do
    printf '\t"%s" = "%s";\n' "${name%.*}" "$(nix-prefetch-url "$url")" >>"$dirname/shas.nix"
done < <(jq -r '.assets[] | .name, .browser_download_url' <<<"$latest_release")

printf '}\n' >> "$dirname/shas.nix"

@doronbehar
Copy link
Contributor Author

Thanks for the suggestion! That's much more reliable I suppose - using the API and not the website's CSS...

@doronbehar doronbehar changed the title nerdfonts: update.sh: parse HTML to generate shas nerdfonts: update.sh: use releases api to generate shas Apr 11, 2020
@marsam marsam merged commit eb54aa1 into NixOS:master Apr 11, 2020
@doronbehar doronbehar mentioned this pull request May 2, 2020
10 tasks
@doronbehar doronbehar deleted the improve-nerd-fonts branch March 2, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some fonts from nerd-fonts are missing
2 participants