summary refs log tree commit diff
path: root/pkgs/data/fonts
diff options
context:
space:
mode:
authorAluísio Augusto Silva Gonçalves <aluisio@aasg.name>2020-10-30 22:22:01 -0300
committerAluísio Augusto Silva Gonçalves <aluisio@aasg.name>2020-11-04 07:47:29 -0300
commite6bc641ef45e773a2eba5ba35fda697faf79cac7 (patch)
treec1e8abe87f0c237fc02e3256e7a5be7595468d03 /pkgs/data/fonts
parente237f23b6afca53ee2640f2e156fdaf171afea58 (diff)
downloadnixpkgs-e6bc641ef45e773a2eba5ba35fda697faf79cac7.tar
nixpkgs-e6bc641ef45e773a2eba5ba35fda697faf79cac7.tar.gz
nixpkgs-e6bc641ef45e773a2eba5ba35fda697faf79cac7.tar.bz2
nixpkgs-e6bc641ef45e773a2eba5ba35fda697faf79cac7.tar.lz
nixpkgs-e6bc641ef45e773a2eba5ba35fda697faf79cac7.tar.xz
nixpkgs-e6bc641ef45e773a2eba5ba35fda697faf79cac7.tar.zst
nixpkgs-e6bc641ef45e773a2eba5ba35fda697faf79cac7.zip
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.
Diffstat (limited to 'pkgs/data/fonts')
-rw-r--r--pkgs/data/fonts/iosevka/default.nix34
-rw-r--r--pkgs/data/fonts/iosevka/package.json28
2 files changed, 21 insertions, 41 deletions
diff --git a/pkgs/data/fonts/iosevka/default.nix b/pkgs/data/fonts/iosevka/default.nix
index 5167c494fa0..36fddc3ce0f 100644
--- a/pkgs/data/fonts/iosevka/default.nix
+++ b/pkgs/data/fonts/iosevka/default.nix
@@ -27,21 +27,29 @@
 
 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 +69,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,9 +80,11 @@ stdenv.mkDerivation rec {
   '';
 
   installPhase = ''
+    runHook preInstall
     fontdir="$out/share/fonts/truetype"
     install -d "$fontdir"
     install "dist/$pname/ttf"/* "$fontdir"
+    runHook postInstall
   '';
 
   enableParallelBuilding = true;
diff --git a/pkgs/data/fonts/iosevka/package.json b/pkgs/data/fonts/iosevka/package.json
deleted file mode 100644
index bc772960882..00000000000
--- a/pkgs/data/fonts/iosevka/package.json
+++ /dev/null
@@ -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"
-	}
-}