Merge pull request #101132 from deviant/iosevka-variants
iosevka-bin: add support for variants
This commit is contained in:
commit
ee9154c4c1
@ -1,20 +1,35 @@
|
||||
{ stdenv, fetchzip }:
|
||||
{ stdenv, lib, fetchurl, unzip
|
||||
, variant ? ""
|
||||
}:
|
||||
|
||||
let
|
||||
version = "3.4.6";
|
||||
in fetchzip {
|
||||
name = "iosevka-bin-${version}";
|
||||
name = "iosevka" + lib.optionalString (variant != "") "-" + variant;
|
||||
|
||||
url = "https://github.com/be5invis/Iosevka/releases/download/v${version}/ttc-iosevka-${version}.zip";
|
||||
variantHashes = import ./variants.nix;
|
||||
validVariants = map (lib.removePrefix "iosevka-")
|
||||
(builtins.attrNames (builtins.removeAttrs variantHashes [ "iosevka" ]));
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "${name}-bin";
|
||||
version = "3.7.1";
|
||||
|
||||
postFetch = ''
|
||||
src = fetchurl {
|
||||
url = "https://github.com/be5invis/Iosevka/releases/download/v${version}/ttc-${name}-${version}.zip";
|
||||
sha256 = variantHashes.${name} or (throw ''
|
||||
No such variant "${variant}" for package iosevka-bin.
|
||||
Valid variants are: ${lib.concatStringsSep ", " validVariants}.
|
||||
'');
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
phases = [ "unpackPhase" ];
|
||||
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/share/fonts
|
||||
unzip -j $downloadedFile \*.ttc -d $out/share/fonts/truetype
|
||||
unzip -d $out/share/fonts/truetype $src
|
||||
'';
|
||||
|
||||
sha256 = "1nab49gkpxahwvvw39xcc32q425qkccr7ffmz87jbcdv71qy7pp9";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
homepage = "https://be5invis.github.io/Iosevka/";
|
||||
downloadPage = "https://github.com/be5invis/Iosevka/releases";
|
||||
description = ''
|
||||
@ -25,4 +40,6 @@ in fetchzip {
|
||||
platforms = platforms.all;
|
||||
maintainers = [ maintainers.cstrahan ];
|
||||
};
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
}
|
||||
|
28
pkgs/data/fonts/iosevka/update.sh
Executable file
28
pkgs/data/fonts/iosevka/update.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#! /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
|
24
pkgs/data/fonts/iosevka/variants.nix
Normal file
24
pkgs/data/fonts/iosevka/variants.nix
Normal file
@ -0,0 +1,24 @@
|
||||
# This file was autogenerated. DO NOT EDIT!
|
||||
{
|
||||
iosevka = "0h226f32nwlqnsdc86bwk2wcdl2hsq5q1s2ln6dsf9m7w8ajn0nr";
|
||||
iosevka-aile = "05k3h7n7mkpdsjcxha27vjj503b4129jd90wj8qyk5h0nrgy1rc6";
|
||||
iosevka-curly = "0fxcc99n9ghkdjmfxba9mg4fc0dwlvnnxlmc618jv6s3k2xn7sza";
|
||||
iosevka-curly-slab = "1qgxyw5v91l4cw3mvqzagk9amyy63iqh72bnsz63daxgss3fpsab";
|
||||
iosevka-etoile = "184rjidnjayv5wsrxxxf39mvdcjafdwcvp0h4rfniy9s0ifrwjvf";
|
||||
iosevka-slab = "1cbrv5pyhnvwrdaj8r011igw2yjgzzigd82g1r10d348lk64wja1";
|
||||
iosevka-sparkle = "124jnjzffnfw58b78svw8rzgal10z5nspwc267pvq7q0f2ak1wpp";
|
||||
iosevka-ss01 = "18ckb0ch4za4vgwqz8azx8vhg9v9a922ffbckrbmy8n5bi03dl7w";
|
||||
iosevka-ss02 = "0cwm2jdni5m9z0xagpmq9vvjp3yvin7c7bnavsj15yfvpq8b8qsp";
|
||||
iosevka-ss03 = "1yzbvkr726f8mm024qzy2hdd7nz4kymgjm0cj5208c57bln0byr2";
|
||||
iosevka-ss04 = "1kpz84a1cb39rxc87whw0fh0k9ak2qbcq59hm425da2acf27a648";
|
||||
iosevka-ss05 = "1xnnm96jnw90mhwylsw1ad6m8pr4r1bd02l7g82m5hmr7bc4b7dd";
|
||||
iosevka-ss06 = "1raw01ijiawaqxfmj0m8z8jrb2ns7vzy68lak63mss8j35xzg1l5";
|
||||
iosevka-ss07 = "0bjhjwjif7qw6wyyrzfg2pdvy1b070k053ndmjard6sh1rcln02d";
|
||||
iosevka-ss08 = "1qwgk8riff57np4hlmd0kcl9bx511x9zmnlrjq3ilfn6abdwgm7i";
|
||||
iosevka-ss09 = "0sfnhmcrsv1v7l756hx70y1mrp35fbs6wrsczw4vxfbbaigs767r";
|
||||
iosevka-ss10 = "10n70z7588h8y2z274vjn6hvzc7lg87znibcmkk2brmx2g5bw2wl";
|
||||
iosevka-ss11 = "0mnyd04vdqr8jm3syv6ddrn61f27k91kxkdy86pp34xaac2ipmm0";
|
||||
iosevka-ss12 = "1f8pn2220s6r566b40ncnqrfmfdhnlr0nkvzj9swgvx66jr8mlhj";
|
||||
iosevka-ss13 = "1py5qgfqm9wp9pzcxg83mydvf3r6nhrqi21d0fvmnk04ghk1psd6";
|
||||
iosevka-ss14 = "0z47kqicd26x5v94zy97xyl277v0s6856pbllfn1gv92ax2dg5cy";
|
||||
}
|
Loading…
Reference in New Issue
Block a user