Files
nixpkgs/pkgs/data/fonts/iosevka/update.sh
T
V d3025ee8c6 iosevka-bin: add support for variants
This adds the ability to select a specific prebuilt variant. It also adds
an updater script for generating their hashes. Additionally, switching
to TTC files reduces the package size by an order of magnitude.

Example usage:

	fonts.fonts = with pkgs; [
	  (iosevka-bin.override { variant = "ss10"; })
	  (iosevka-bin.override { variant = "sparkle"; })
	  (iosevka-bin.override { variant = "aile"; })
	];
2020-10-30 21:19:20 +01:00

29 lines
946 B
Bash
Executable File

#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq
set -e
release=$(curl -s https://api.github.com/repos/be5invis/Iosevka/releases/latest)
oldVersion=$(nix-instantiate --eval -E 'with import ./. {}; lib.getVersion iosevka-bin' | tr -d '"')
version=$(echo "$release" | jq -r .tag_name | tr -d v)
if test "$oldVersion" = "$version"; then
echo "New version same as old version, nothing to do." >&2
exit 0
fi
file=$(nix-instantiate --eval -A iosevka-bin.meta.position | sed -r 's/^"(.*):[0-9]+"$/\1/')
sed -i "s/$oldVersion/$version/" "$file"
{
echo '# This file was autogenerated. DO NOT EDIT!'
echo '{'
for asset in $(echo "$release" | jq -r '.assets[].name | select(startswith("ttc"))'); do
printf ' %s = "%s";\n' \
$(echo "$asset" | sed -r "s/^ttc-(.*)-$version.zip$/\1/") \
$(nix-prefetch-url "https://github.com/be5invis/Iosevka/releases/download/v$version/$asset")
done
echo '}'
} >$(dirname "$file")/variants.nix