iosevka: 3.2.2 -> 3.7.1; fetch source through nodePackages

Previously we used nodePackages only to fetch Iosevka's build
dependencies and then fetched the source code ourselves.  Updates
involved changing the version and hashes in the `iosevka` derivation and
then running node-packages/generate.sh to update the build dependencies,
which in turns updates *all* of node-packages.nix.

A new proposed policy for handling node-packages.nix updates involves
batching those updates.  Previously, that would mean `iosevka` and its
build dependencies could end up out of sync until the batched update was
run.

To work with the new policy, we now fetch Iosevka's source code (and
not only its dependencies) through nodePackages.  Updates are done by
changing the source URL in node-packages.json, which eventually becomes
part of an update of node-packages.nix, which is then propagated to
`iosevka` itself.

One con of this strategy is that errors can not be caught directly
after the update, but only after node-packages.nix is regenerated.
This commit is contained in:
Aluísio Augusto Silva Gonçalves 2020-10-30 22:22:01 -03:00
parent e237f23b6a
commit e6bc641ef4
No known key found for this signature in database
GPG Key ID: DA6EA2FACDB1CBD2
3 changed files with 22 additions and 42 deletions

View File

@ -27,21 +27,29 @@
assert (privateBuildPlan != null) -> set != null; 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 { stdenv.mkDerivation rec {
pname = if set != null then "iosevka-${set}" else "iosevka"; pname = if set != null then "iosevka-${set}" else "iosevka";
inherit (nodeIosevka) version src;
version = "3.2.2";
src = fetchFromGitHub {
owner = "be5invis";
repo = "Iosevka";
rev = "v${version}";
sha256 = "1wbnp6gr3ywvspwk6i0jn68zwjmsd38arn4n2dkh7mdkrmvah81k";
};
nativeBuildInputs = [ nativeBuildInputs = [
nodejs nodejs
nodePackages."iosevka-build-deps-../../data/fonts/iosevka" nodeIosevka
remarshal remarshal
otfcc otfcc
ttfautohint-nox ttfautohint-nox
@ -61,9 +69,7 @@ stdenv.mkDerivation rec {
echo -e "\n" >> parameters.toml echo -e "\n" >> parameters.toml
cat "$extraParametersPath" >> parameters.toml cat "$extraParametersPath" >> parameters.toml
''} ''}
ln -s ${ ln -s ${nodeIosevka}/lib/node_modules/iosevka/node_modules .
nodePackages."iosevka-build-deps-../../data/fonts/iosevka"
}/lib/node_modules/iosevka-build-deps/node_modules .
runHook postConfigure runHook postConfigure
''; '';
@ -74,9 +80,11 @@ stdenv.mkDerivation rec {
''; '';
installPhase = '' installPhase = ''
runHook preInstall
fontdir="$out/share/fonts/truetype" fontdir="$out/share/fonts/truetype"
install -d "$fontdir" install -d "$fontdir"
install "dist/$pname/ttf"/* "$fontdir" install "dist/$pname/ttf"/* "$fontdir"
runHook postInstall
''; '';
enableParallelBuilding = true; enableParallelBuilding = true;

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

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