Skip to content

Commit

Permalink
nerdfonts: separate into individual font packages, 3.2.1 -> 3.3.0 (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar authored Nov 26, 2024
2 parents fdb2b48 + 536dc87 commit de4dbc5
Show file tree
Hide file tree
Showing 14 changed files with 844 additions and 182 deletions.
5 changes: 5 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,11 @@
- The `atlassian-crowd` package and its `services.crowd` NixOS module
- The `atlassian-jira` package and its `services.jira` NixOS module

- `nerdfonts` has been separated into individual font packages under the namespace `nerd-fonts`. The directories for font
files have changed from `$out/share/fonts/{opentype,truetype}/NerdFonts` to
`$out/share/fonts/{opentype,truetype}/NerdFonts/<fontDirName>`, where `<fontDirName>` can be found in the
[official website](https://www.nerdfonts.com/font-downloads) as the titles in preview images, with the "Nerd Font"
suffix and any whitespaces trimmed.

- `python3Packages.nose` has been removed, as it has been deprecated and unmaintained for almost a decade and does not work on Python 3.12.
Please switch to `pytest` or another test runner/framework.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/terminal-emulators/kitty/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
, harfbuzz, fontconfig, pkg-config, ncurses, imagemagick
, libstartup_notification, libGL, libX11, libXrandr, libXinerama, libXcursor
, libxkbcommon, libXi, libXext, wayland-protocols, wayland, xxHash
, nerdfonts
, nerd-fonts
, lcms2
, librsync
, openssl
Expand Down Expand Up @@ -144,7 +144,7 @@ buildPythonApplication rec {
# Add the font by hand because fontconfig does not finds it in darwin
mkdir ./fonts/
cp "${(nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];})}/share/fonts/truetype/NerdFonts/SymbolsNerdFontMono-Regular.ttf" ./fonts/
cp "${nerd-fonts.symbols-only}/share/fonts/truetype/NerdFonts/Symbols/SymbolsNerdFontMono-Regular.ttf" ./fonts/
${ lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) "export MACOSX_DEPLOYMENT_TARGET=11" }
${if stdenv.hostPlatform.isDarwin then ''
Expand Down
28 changes: 28 additions & 0 deletions pkgs/data/fonts/nerd-fonts/convert-license.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
lib:
let
ls = lib.licenses;
in
licenseString:
builtins.getAttr licenseString (
(
with builtins;
lib.trivial.pipe (attrValues ls) [
(filter (l: l ? spdxId))
(map (l: lib.attrsets.nameValuePair l.spdxId l))
listToAttrs
]
)
// {
"Bitstream-Vera AND MIT" = with ls; [
bitstreamVera
mit
];
"LicenseRef-Monofur" = ls.free; # upstream `src/unpatched-fonts/Monofur/LICENSE.txt`
"LicenseRef-UbuntuFont" = ls.ufl;
"LicenseRef-VicFieger" = ls.free; # upstream `src/unpatched-fonts/HeavyData/Vic Fieger License.txt`
"MIT OR OFL-1.1-no-RFN" = ls.mit;
"OFL-1.1-RFN" = ls.ofl;
"OFL-1.1-no-RFN or LGPL-2.1-only" = ls.ofl;
"OFL-1.1-no-RFN" = ls.ofl;
}
)
94 changes: 94 additions & 0 deletions pkgs/data/fonts/nerd-fonts/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
lib,
stdenvNoCC,
fetchurl,
}:

let
releaseInfo = lib.trivial.importJSON ./manifests/release.json;
fontsInfo = lib.trivial.importJSON ./manifests/fonts.json;
checksums = lib.trivial.importJSON ./manifests/checksums.json;

convertAttrName =
name:
let
lowerName = lib.strings.toLower name;
in
if builtins.match "[[:digit:]].*" lowerName != null then "_" + lowerName else lowerName;

convertVersion =
version: date:
if builtins.match "[[:digit:]].*" version != null then
version
else
"0-unstable-" + builtins.head (lib.strings.splitString "T" date);

convertLicense = import ./convert-license.nix lib;

makeNerdFont =
{
caskName,
description,
folderName,
licenseId,
patchedName,
version,
...
}:
stdenvNoCC.mkDerivation {
pname = lib.strings.toLower caskName;
version = convertVersion version releaseInfo.published_at;

src =
let
filename = folderName + ".tar.xz";
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/${releaseInfo.tag_name}/${filename}";
sha256 = checksums.${filename};
in
fetchurl {
inherit url sha256;
};

sourceRoot = ".";

installPhase =
let
dirName = lib.strings.concatStrings (lib.strings.splitString " " patchedName);
in
''
runHook preInstall
dst_opentype=$out/share/fonts/opentype/NerdFonts/${dirName}
dst_truetype=$out/share/fonts/truetype/NerdFonts/${dirName}
find -name \*.otf -exec mkdir -p $dst_opentype \; -exec cp -p {} $dst_opentype \;
find -name \*.ttf -exec mkdir -p $dst_truetype \; -exec cp -p {} $dst_truetype \;
runHook postInstall
'';

passthru.updateScript = {
command = ./update.py;
supportedFeatures = [ "commit" ];
};

meta = {
description = "Nerd Fonts: " + description;
license = convertLicense licenseId;
homepage = "https://nerdfonts.com/";
changelog = "https://github.com/ryanoasis/nerd-fonts/blob/${releaseInfo.tag_name}/changelog.md";
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [
doronbehar
rc-zb
];
};
};

nerdFonts = lib.trivial.pipe fontsInfo [
(map (font: lib.attrsets.nameValuePair (convertAttrName font.caskName) (makeNerdFont font)))
builtins.listToAttrs
];
in

nerdFonts
70 changes: 70 additions & 0 deletions pkgs/data/fonts/nerd-fonts/manifests/checksums.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"0xProto.tar.xz": "d72bdd83f02a9071d4bb0acd38a37fe687a47bd29189e838edf847ed39b87e10",
"3270.tar.xz": "304010729a11da9bea9f2f1e35e84f4f2240cd8b0ec2a315ef3c1af0ba3af185",
"Agave.tar.xz": "2f7939592934ac02ed74e90556a7e13e95ca621b6e44df31db729ae6930f9cb4",
"AnonymousPro.tar.xz": "85798dd957cb18837c387ca7fd43044a62830a58860d24e7bd315fc10b5b94f6",
"Arimo.tar.xz": "4abbf467968a0f31bb3ad8da7ecd15117cdc8265a67a793e5b9ded6437654ce7",
"AurulentSansMono.tar.xz": "b1898e9bbfa1cbea8fd514b151ff4bb572d2562234e942408a9ef90dfb14075f",
"BigBlueTerminal.tar.xz": "44bf48101c6c31f6777a42430021681cf54c2f0699f1357a33c73c8788c5aa35",
"BitstreamVeraSansMono.tar.xz": "0e5c4ed24358be59a8f7268f3b7352d92f5f19894cdbc62e3c0d91af16250d95",
"CascadiaCode.tar.xz": "86ac1e16199fe9c3448a7882e4f3e90c11c27396fd4771c552661648e3d18f96",
"CascadiaMono.tar.xz": "29e494f00c6ec0bbbeba031cb69f30ebbe4cf46945d341e0347aab7073049bf0",
"CodeNewRoman.tar.xz": "b032b5521c070076148f986d861708ed142fe19f2014a9f248ca4d0a43e9cc8e",
"ComicShannsMono.tar.xz": "cb3667e107e265010566d05e544170b57eec3808f33b0c1790b3b1bd069690aa",
"CommitMono.tar.xz": "aa7f15a591374a04379223a0c224cd66a7c98938e52cda306311681cc51a1c22",
"Cousine.tar.xz": "c7ee3224ff34c69fadfe947d5a9bf349952206cf8e0708564f7cf3d49095d4d8",
"D2Coding.tar.xz": "cad0abe4898b6d9aa12d28c4383ea7260eadba951b6ed9d347a524efc234dd1b",
"DaddyTimeMono.tar.xz": "8a4b6f1fda69bad7dbf102059416998caa5a870fb413c49e88d64ac2912a93e5",
"DejaVuSansMono.tar.xz": "e02d9dcf740b6fe72288ece5ea235a78cdc3763502b2682d7659c7618d4400c5",
"DepartureMono.tar.xz": "45dca8cadd11f6eb289c13f66be3ad7fbd525504168d3c0931d57c8ad56be909",
"DroidSansMono.tar.xz": "1e2b79f888e4d07617857ddae0f82ffe07b65328fc0664e9a94bc0fac1aef888",
"EnvyCodeR.tar.xz": "be99355fc93e9c351a4c70d7713c8f4fe038a65ac72f7ac9cc5550bc52734b70",
"FantasqueSansMono.tar.xz": "947166571476762b8e9b87a6b0532f9eab29147dc9e5d15aad1b7983229328d7",
"FiraCode.tar.xz": "7c64c44d7e530b25faf23904e135e9d1ff0339a92ee64e35e7da9116aa48af67",
"FiraMono.tar.xz": "d23c8db9d53397606bcfe6593f576abb12dd8e3d0605062231e391e2719e92c0",
"GeistMono.tar.xz": "8c5cacfa8a1fe276ea4ebdbe3b542ce71a7144c04a811c9f210faa401b436b3b",
"Go-Mono.tar.xz": "d3d2a8ec7f30513e52412f8907ec4838fd5843323b9e2a5a841de6531aff9a3a",
"Gohu.tar.xz": "da43efcf1eb53dc1773938861a9f3fcb19b71065a6a5bb0295e6038e90545027",
"Hack.tar.xz": "f797524e4b99191a5f35614c6fe48e96f7b8872712e2943a2aaf59cda086e909",
"Hasklig.tar.xz": "9cb2f02337782dd5eb1711f9890edaeea3d59eca00dd7ea3810c237336883fe3",
"HeavyData.tar.xz": "a3473e58cf5a7469a511dfdba2935611945e5cbd2f17d09a361c1ce19a30df0f",
"Hermit.tar.xz": "fddd0ada8ab3266042d4f6ddb3dd7a9c652c15ac80eda35097c3914281e14db0",
"IBMPlexMono.tar.xz": "f7b420dae1361d347858c78d6d48e385bc644e32781cc21eb7dcc483c3682eb1",
"Inconsolata.tar.xz": "d843486d7bab95ccf06c6c17ef03773b2dc5b284602b3926356a668c49be565f",
"InconsolataGo.tar.xz": "105963a2025b4cb96798d1538f38aa65bd13a856cda9941ce25c139959eccd03",
"InconsolataLGC.tar.xz": "442501cffb407e11539fa9fb4714253d779dd0508c0257c42eec187f11a18b13",
"IntelOneMono.tar.xz": "0a5287b9e24a9adce148daea25c04242ae65f9bb04e3610c8374eaca7379ec20",
"Iosevka.tar.xz": "01b352cd732b36d24fb7b0f2b331ddc34c2a39155af6e7a42bddf2ee279bb25d",
"IosevkaTerm.tar.xz": "5ca2a43d1ed2a0098fbc9f87e7dc89c6a13d0399bcb82f09359fa141f9afb70b",
"IosevkaTermSlab.tar.xz": "c8e7e72b6652adb34e4f0af20e22d1eda06368db3a6ebab5194d1078944ea31a",
"JetBrainsMono.tar.xz": "7d171ea3884be22fc08bf1a1aee640a3dc93f031989c27f6f9ceb30a6a668de1",
"Lekton.tar.xz": "2f83aabdf69d1ae28e9b60ef3777e572aafc359f32c8eae7a6278337f1364014",
"LiberationMono.tar.xz": "cc2d9a78c88c91875d8fee10d7d5d67ee9f0687ef004fd61bee4e7a1ecef700b",
"Lilex.tar.xz": "1f4d1c13252f12e9b09e09f881ea21a77645e1eac3472604990b3a11deea78c1",
"MPlus.tar.xz": "55d7390e8b45fc19a028dd93d42aebf0fe55fd85321940d1be13a5f6fa592e76",
"MartianMono.tar.xz": "7cad96ae914fecff010fa438276a99daf984044ade8b473049b3b63f771a5603",
"Meslo.tar.xz": "6ad716ed719e2c97794abd5856a90c6131c406606b249debdc83b04ae11f4cb7",
"Monaspace.tar.xz": "faeb907827a2a07ae64c8fa1a5ca48cd9e60c9084a24c48d779a30cf6bd0693a",
"Monofur.tar.xz": "9dfad24a7debf0ca56db2465e8bd5a0a28435945c23e2a831bcd111785b57480",
"Monoid.tar.xz": "51765143936c5c5078249eb77f2dc862f0d9436328c4c698918b276637d5caee",
"Mononoki.tar.xz": "b9bff1032796daffef71610639685d28a4a5baf31cb4ca43dd53f3d14820f5cf",
"NerdFontsSymbolsOnly.tar.xz": "8b5ecbe2612cb37d75e2645f7644876bc38960574909b1c01c002d0e8d33deb3",
"Noto.tar.xz": "556a30d1dcdbf565946605f50657fa77105d95d150413492cfa7065263f56427",
"OpenDyslexic.tar.xz": "5cd679c82f992f4140f2ab4f6cb77b0080f71a3d7152fb8c91fe0c07f4dcce83",
"Overpass.tar.xz": "6dc50cddca27afa51bd2cce334d6b451d6ce56e6f955c06518ae5b9b1f99e9fc",
"ProFont.tar.xz": "960a9f36ea58ab07c2955b8cb37b4386626ae19b23d026095ef896a05842dadb",
"ProggyClean.tar.xz": "70e91ef90a6d6230f6870a978b856e6138dcff0b98efa9ba3e84c447dda638a2",
"Recursive.tar.xz": "2c9d0b6db82ef6acf71b235b5bd7b16f33cfbbba5ce08bfb1278f7dc6ec1eb20",
"RobotoMono.tar.xz": "fad79b182e2c27454276b45d9633c0800302da996168bc5cee0109fda2181ed3",
"ShareTechMono.tar.xz": "0f7fb196b3700caeee85ddad56efde174416d73afc651a79d38bd319c1587d43",
"SourceCodePro.tar.xz": "87834bca780558bbe3ff808e51c89e1c3d98140a2c1a0d3100e10e944456a63c",
"SpaceMono.tar.xz": "a2058cfc43eee5a170208c6e90fa77d8f0aa755e0d213e795f70781f7d807942",
"Terminus.tar.xz": "88b17b50aab7ee284f9a1ed395f96c20ab4d22640fde1fe0f80a31f1eacd6585",
"Tinos.tar.xz": "f763b82e01f06ebce5830c475306598734d2fc91ded1760fe925a826b3cba8ef",
"Ubuntu.tar.xz": "4ff08c04bec3ec86b60d75a987b5c09d7e5c434f006f426bcfdac80f6f66d938",
"UbuntuMono.tar.xz": "dc8a6aebd8950e59dd89a1c5f49be3914879691e2e1293c157b7f66291c09712",
"UbuntuSans.tar.xz": "3d0ed4bbadf13f9655c5e4a3bc089eef6db232fa3d4552144b1683adc9fad98d",
"VictorMono.tar.xz": "f61229287e333e575f134923fd46da32fe4e01120a2a74a17d2d9b7591a9b87e",
"ZedMono.tar.xz": "fa29af2373bbf6edda1c3c9a42655227748d1a9f7b2563bf4b79253618768318",
"iA-Writer.tar.xz": "50d885c7f03931323c5ea232c677b8963f8d1a196cfd8f2935e2ddcf535b5971"
}
Loading

0 comments on commit de4dbc5

Please sign in to comment.