Merge pull request #99004 from AluisioASG/aasg/iosevka

This commit is contained in:
Doron Behar 2020-11-04 17:30:13 +02:00 committed by GitHub
commit 81c5e31043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 687 additions and 484 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, unzip
{ stdenv, lib, fetchurl, iosevka, unzip
, variant ? ""
}:
@ -29,17 +29,11 @@ in stdenv.mkDerivation rec {
unzip -d $out/share/fonts/truetype $src
'';
meta = with lib; {
homepage = "https://be5invis.github.io/Iosevka/";
downloadPage = "https://github.com/be5invis/Iosevka/releases";
description = ''
Slender monospace sans-serif and slab-serif typeface inspired by Pragmata
Pro, M+ and PF DIN Mono, designed to be the ideal font for programming.
'';
license = licenses.ofl;
platforms = platforms.all;
maintainers = [ maintainers.cstrahan ];
meta = iosevka.meta // {
maintainers = with lib.maintainers; [
cstrahan
];
};
passthru.updateScript = ./update.sh;
passthru.updateScript = ./update-bin.sh;
}

View File

@ -1,5 +1,5 @@
{ stdenv, lib, pkgs, fetchFromGitHub, nodejs, nodePackages, remarshal
, ttfautohint-nox, otfcc
, ttfautohint-nox
# Custom font set options.
# See https://github.com/be5invis/Iosevka#build-your-own-style
@ -27,23 +27,30 @@
assert (privateBuildPlan != null) -> set != null;
let
# We don't know the attribute name for the Iosevka package as it
# changes not when our update script is run (which in turn updates
# node-packages.json, but when node-packages/generate.sh is run
# (which updates node-packages.nix).
#
# Doing it this way ensures that the package can always be built,
# although possibly an older version than ioseva-bin.
nodeIosevka = (
lib.findSingle
(drv: drv ? packageName && drv.packageName == "iosevka")
(throw "no 'iosevka' package found in nodePackages")
(throw "multiple 'iosevka' packages found in nodePackages")
(lib.attrValues nodePackages)
).override (drv: { dontNpmInstall = true; });
in
stdenv.mkDerivation rec {
pname = if set != null then "iosevka-${set}" else "iosevka";
version = "3.2.2";
src = fetchFromGitHub {
owner = "be5invis";
repo = "Iosevka";
rev = "v${version}";
sha256 = "1wbnp6gr3ywvspwk6i0jn68zwjmsd38arn4n2dkh7mdkrmvah81k";
};
inherit (nodeIosevka) version src;
nativeBuildInputs = [
nodejs
nodePackages."iosevka-build-deps-../../data/fonts/iosevka"
nodeIosevka
remarshal
otfcc
ttfautohint-nox
];
@ -61,9 +68,7 @@ stdenv.mkDerivation rec {
echo -e "\n" >> parameters.toml
cat "$extraParametersPath" >> parameters.toml
''}
ln -s ${
nodePackages."iosevka-build-deps-../../data/fonts/iosevka"
}/lib/node_modules/iosevka-build-deps/node_modules .
ln -s ${nodeIosevka}/lib/node_modules/iosevka/node_modules .
runHook postConfigure
'';
@ -74,13 +79,19 @@ stdenv.mkDerivation rec {
'';
installPhase = ''
runHook preInstall
fontdir="$out/share/fonts/truetype"
install -d "$fontdir"
install "dist/$pname/ttf"/* "$fontdir"
runHook postInstall
'';
enableParallelBuilding = true;
passthru = {
updateScript = ./update-default.sh;
};
meta = with stdenv.lib; {
homepage = "https://be5invis.github.io/Iosevka";
downloadPage = "https://github.com/be5invis/Iosevka/releases";
@ -96,6 +107,7 @@ stdenv.mkDerivation rec {
ttuegel
babariviere
rileyinman
AluisioASG
];
};
}

View File

@ -1,28 +0,0 @@
{
"name": "iosevka-build-deps",
"version": "3.2.2",
"scripts": {
"build": "verda -f verdafile.js"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"cldr": "^5.5.4",
"ejs": "^3.1.3",
"fs-extra": "^9.0.0",
"object-assign": "^4.1.1",
"otfcc-ttcize": "^0.10.2",
"patel": "^0.33.1",
"prettier": "^2.0.5",
"semver": "^7.1.3",
"spiro": "^2.0.0",
"stylus": "^0.54.7",
"topsort": "^0.0.2",
"ttf2woff": "^2.0.1",
"ttf2woff2": "^3.0.0",
"typo-geom": "^0.8.0",
"unicode-13.0.0": "^0.8.0",
"unorm": "^1.6.0",
"verda": "^1.0.1",
"which": "^2.0.2"
}
}

View File

@ -1,11 +1,12 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq
set -e
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
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 '"')
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
@ -13,8 +14,7 @@ if test "$oldVersion" = "$version"; then
exit 0
fi
file=$(nix-instantiate --eval -A iosevka-bin.meta.position | sed -r 's/^"(.*):[0-9]+"$/\1/')
sed -i "s/$oldVersion/$version/" "$file"
sed -i "s/$oldVersion/$version/" bin.nix
{
echo '# This file was autogenerated. DO NOT EDIT!'
@ -25,4 +25,4 @@ sed -i "s/$oldVersion/$version/" "$file"
$(nix-prefetch-url "https://github.com/be5invis/Iosevka/releases/download/v$version/$asset")
done
echo '}'
} >$(dirname "$file")/variants.nix
} >variants.nix

View File

@ -0,0 +1,21 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts coreutils gawk replace
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
nixpkgs=../../../..
repo=https://github.com/be5invis/Iosevka
# Discover the latest version.
current_version=$(nix-instantiate "$nixpkgs" --eval --strict -A iosevka.version | tr -d '"')
new_version=$(list-git-tags "$repo" | sort --reverse --version-sort | awk 'match($0, /^v([0-9.]+)$/, m) { print m[1]; exit; }')
if [[ "$new_version" == "$current_version" ]]; then
echo "iosevka: no update found"
exit
fi
# Update the source package in nodePackages.
current_source="$repo/archive/v$current_version.tar.gz"
new_source="$repo/archive/v$new_version.tar.gz"
replace-literal -ef "$current_source" "$new_source" ../../../development/node-packages/node-packages.json
echo "iosevka: $current_version -> $new_version (after nodePackages update)"

View File

@ -100,7 +100,7 @@
, "indium"
, "insect"
, "ionic"
, { "iosevka-build-deps": "../../data/fonts/iosevka" }
, {"iosevka": "https://github.com/be5invis/Iosevka/archive/v3.7.1.tar.gz"}
, "jake"
, "javascript-typescript-langserver"
, "joplin"

File diff suppressed because it is too large Load Diff