ibm-plex: 1.1.0 -> 0-unstable-2026-02-12, refactor

- Refactor the derivation to link multiple derivations together, one
  for each font family, instead of one derivation for all font families,
  to allow for independent versioning of each font.

- Remove no longer valid `meta.changelog` link.

- Remove no longer valid `passthru.update` script.
This commit is contained in:
magicquark
2026-05-26 03:24:15 +01:00
parent 8c65cc9e0f
commit 71cd871a03
5 changed files with 140 additions and 93 deletions
+99
View File
@@ -0,0 +1,99 @@
{
math = {
hash = "sha256-dJA6uqxa/yb3eLY4l39NeP0yIl2NfrbaRpf6h0/F7Xc=";
name = "IBM Plex Math";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-math@1.1.0/ibm-plex-math.zip";
version = "1.1.0";
};
mono = {
hash = "sha256-OwUmrPfEehLDz0fl2ChYLK8FQM2p0G1+EMrGsYEq+6g=";
name = "IBM Plex Mono";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-mono@1.1.0/ibm-plex-mono.zip";
version = "1.1.0";
};
sans = {
hash = "sha256-mK+8GGl2ugF2+fS6yd3p5NWPHHcKEJWiShDS3lihOlI=";
name = "IBM Plex Sans";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans@1.1.0/ibm-plex-sans.zip";
version = "1.1.0";
};
sans-arabic = {
hash = "sha256-qi4k7kMLftIuq87idyxq46FOD6QYycdG6j3zJmu8mhI=";
name = "IBM Plex Sans Arabic";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-arabic@1.1.0/ibm-plex-sans-arabic.zip";
version = "1.1.0";
};
sans-condensed = {
hash = "sha256-prqyJIPs+UpQxFTbn/eAfsG/jKwQTOO72fZNzAtXUWg=";
name = "IBM Plex Sans Condensed";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-condensed@2.0.0/ibm-plex-sans-condensed.zip";
version = "2.0.0";
};
sans-devanagari = {
hash = "sha256-K57OVqcH5r9tZx8NFEoz1P3xpUooqpF7xxJzNmnObwE=";
name = "IBM Plex Sans Devanagari";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-devanagari@1.1.0/ibm-plex-sans-devanagari.zip";
version = "1.1.0";
};
sans-hebrew = {
hash = "sha256-rTuBQYLI+6gEFTumCdaWpeoLzRoyFSmqWbXziq+UG6I=";
name = "IBM Plex Sans Hebrew";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-hebrew@1.1.0/ibm-plex-sans-hebrew.zip";
version = "1.1.0";
};
sans-jp = {
hash = "sha256-2BbhqsutMXEoS2JoZjJprrElIpFa9lgvPaM65pnYdfs=";
name = "IBM Plex Sans Japanese";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-jp@3.0.0/ibm-plex-sans-jp.zip";
version = "3.0.0";
};
sans-kr = {
hash = "sha256-FsHxMvLlI4yylgG96DOZIdW2DYpk7I+c5QgkVIkNZIE=";
name = "IBM Plex Sans Korean";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-kr@1.1.0/ibm-plex-sans-kr.zip";
version = "1.1.0";
};
sans-sc = {
hash = "sha256-Q3cEVlR/UkNZaGIhNMIdojId6fHmAsZdLwMsKq1zLRY=";
name = "IBM Plex Sans Chinese SC";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-sc@1.1.0/ibm-plex-sans-sc.zip";
version = "1.1.0";
};
sans-tc = {
hash = "sha256-kZvzSK6fEjfVMR4kxC4lxtD7GskqvJZx8BBJVT4T9MU=";
name = "IBM Plex Sans Chinese TC";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-tc@1.1.1/ibm-plex-sans-tc.zip";
version = "1.1.1";
};
sans-thai = {
hash = "sha256-JZVbvZdj+IfBthiqivOXHrvAUe392M9ECGsiJkm0saE=";
name = "IBM Plex Sans Thai";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-thai@1.1.0/ibm-plex-sans-thai.zip";
version = "1.1.0";
};
sans-thai-looped = {
hash = "sha256-cry/Ctwt1bsrdbvWkJIYWLjsvV6a1lLFsT85znqERnw=";
name = "IBM Plex Sans Thai Looped";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-thai-looped@1.1.0/ibm-plex-sans-thai-looped.zip";
version = "1.1.0";
};
sans-variable = {
hash = "sha256-W45wPOmmP4KuJ3TVes2x0n25KgyDzX48ce1lQrjAXpw=";
name = "IBM Plex Sans (Variable)";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-sans-variable@0.2.0/plex-sans-variable.zip";
version = "0.2.0";
};
serif = {
hash = "sha256-PO9KxV4K3a7fB4fR/i7LSf0mhK4I2eUDMsbSYWDQcb4=";
name = "IBM Plex Serif";
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-serif@2.0.0/ibm-plex-serif.zip";
version = "2.0.0";
};
serif-variable = {
hash = "sha256-xhjmeIMT7FAFhfR8fekAxzQEl1hOtPdQ6qsVpnZN6Xg=";
name = "IBM Plex Serif (Variable)";
stripRoot = false;
url = "https://github.com/IBM/plex/releases/download/@ibm/plex-serif-variable@2.0.0/plex-serif-variable.zip";
version = "2.0.0";
};
}
-16
View File
@@ -1,16 +0,0 @@
{
"serif" = "sha256-8ygaAeMKygYS4GCub4YUQmkh87pYHfi3s0PQ6AbaeGw=";
"sans" = "sha256-mK+8GGl2ugF2+fS6yd3p5NWPHHcKEJWiShDS3lihOlI=";
"sans-condensed" = "sha256-/aJTXmrHuoPSrtCKNodBY7I0CriayNTx5LCXw+/MFvE=";
"sans-arabic" = "sha256-qi4k7kMLftIuq87idyxq46FOD6QYycdG6j3zJmu8mhI=";
"sans-devanagari" = "sha256-K57OVqcH5r9tZx8NFEoz1P3xpUooqpF7xxJzNmnObwE=";
"sans-thai" = "sha256-JZVbvZdj+IfBthiqivOXHrvAUe392M9ECGsiJkm0saE=";
"sans-thai-looped" = "sha256-cry/Ctwt1bsrdbvWkJIYWLjsvV6a1lLFsT85znqERnw=";
"sans-sc" = "sha256-Q3cEVlR/UkNZaGIhNMIdojId6fHmAsZdLwMsKq1zLRY=";
"sans-tc" = "sha256-kZvzSK6fEjfVMR4kxC4lxtD7GskqvJZx8BBJVT4T9MU=";
"sans-kr" = "sha256-FsHxMvLlI4yylgG96DOZIdW2DYpk7I+c5QgkVIkNZIE=";
"sans-jp" = "sha256-hUl/SSkN6q3pDTtrY2mJepw3ljhhLJskGbxfsTl9TuI=";
"sans-hebrew" = "sha256-rTuBQYLI+6gEFTumCdaWpeoLzRoyFSmqWbXziq+UG6I=";
"mono" = "sha256-OwUmrPfEehLDz0fl2ChYLK8FQM2p0G1+EMrGsYEq+6g=";
"math" = "sha256-dJA6uqxa/yb3eLY4l39NeP0yIl2NfrbaRpf6h0/F7Xc=";
}
+41 -33
View File
@@ -1,54 +1,54 @@
{
lib,
stdenvNoCC,
fetchzip,
symlinkJoin,
fetchzip,
installFonts,
families ? [ ],
}:
let
version = import ./version.nix;
availableFamilies = import ./hashes.nix;
availableFamilyNames = builtins.attrNames availableFamilies;
allFonts = import ./fonts.nix;
availableFamilyNames = builtins.attrNames allFonts;
selectedFamilies = if (families == [ ]) then availableFamilyNames else families;
unknownFamilies = lib.subtractLists availableFamilyNames families;
in
assert lib.assertMsg (unknownFamilies == [ ]) "Unknown font(s): ${toString unknownFamilies}";
stdenvNoCC.mkDerivation {
pname = "ibm-plex";
inherit version;
fontsToBuild = lib.filterAttrs (name: _: lib.elem name selectedFamilies) allFonts;
makeFont =
font:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = lib.toLower (lib.replaceStrings [ " (" ")" " " ] [ "-" "" "-" ] font.name);
inherit (font) version;
src = symlinkJoin {
name = "ibm-plex-src";
paths = map (
family:
fetchzip {
url = "https://github.com/IBM/plex/releases/download/%40ibm%2Fplex-${family}%40${version}/ibm-plex-${family}.zip";
hash = availableFamilies.${family};
}
) selectedFamilies;
postBuild = ''
find "$out" \( -name unhinted -or -name split \) -exec rm -fr {} +
'';
};
nativeBuildInputs = [ installFonts ];
sourceRoot = ".";
outputs = [
"out"
"webfont"
];
nativeBuildInputs = [ installFonts ];
src = fetchzip {
inherit (font) hash url;
stripRoot = font.stripRoot or true;
};
outputs = [
"out"
"webfont"
];
passthru.updateScript = ./update.sh;
# Some fonts, e.g. "ibm-plex-sans-korean" and "ibm-plex-sans-japanese"
# include both unhinted and hinted variants of the ttf and woff/woff2 type
# fonts, which collide when using the `installFonts` hook.
# Default to installing the hinted variant of the fonts.
#
# Additionally, fonts with webfonts include complete and split forms.
# Default to the complete forms.
preInstall = ''
find . -type d \( -name unhinted -or -name split \) -exec rm -rf {} +
'';
meta = meta // {
description = font.name;
};
});
fontDerivations = lib.mapAttrs (_: v: makeFont v) fontsToBuild;
meta = {
description = "IBM Plex Typeface";
homepage = "https://www.ibm.com/plex/";
changelog = "https://github.com/IBM/plex/raw/v${version}/CHANGELOG.md";
license = lib.licenses.ofl;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [
@@ -57,4 +57,12 @@ stdenvNoCC.mkDerivation {
ryanccn
];
};
in
assert lib.assertMsg (unknownFamilies == [ ]) "Unknown font(s): ${toString unknownFamilies}";
symlinkJoin {
pname = "ibm-plex";
version = "0-unstable-2026-02-12";
paths = lib.attrValues fontDerivations;
passthru = fontDerivations;
inherit meta;
}
-43
View File
@@ -1,43 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix nix-prefetch jq
# shellcheck shell=bash
set -eo pipefail
families=(
"serif"
"sans"
"sans-condensed"
"sans-arabic"
"sans-devanagari"
"sans-thai"
"sans-thai-looped"
"sans-sc"
"sans-tc"
"sans-kr"
"sans-jp"
"sans-hebrew"
"mono"
"math"
)
version=$(curl --silent 'https://api.github.com/repos/IBM/plex/releases/latest' | jq -r '.tag_name | sub("^@ibm/[\\w-]+@"; "")')
dirname="$(dirname "$0")"
echo \""${version}"\" >"$dirname/version-new.nix"
if diff -q "$dirname/version-new.nix" "$dirname/version.nix"; then
echo No new version available, current: "$version"
rm "$dirname/version-new.nix"
exit 0
else
echo Updated to version "$version"
mv "$dirname/version-new.nix" "$dirname/version.nix"
fi
printf '{\n' > "$dirname/hashes.nix"
for family in "${families[@]}"; do
url="https://github.com/IBM/plex/releases/download/%40ibm%2Fplex-${family}%40${version}/ibm-plex-${family}.zip"
printf ' "%s" = "%s";\n' "$family" "$(nix-prefetch-url --unpack "$url" | xargs nix --extra-experimental-features nix-command hash convert --hash-algo sha256)" >>"$dirname/hashes.nix"
done
printf '}\n' >> "$dirname/hashes.nix"
-1
View File
@@ -1 +0,0 @@
"1.1.0"