Skip to content

Commit

Permalink
nerdfonts: separate into individual packages under namespace nerd-fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
rc-zb committed Nov 10, 2024
1 parent df10ec7 commit bfc0b4f
Show file tree
Hide file tree
Showing 12 changed files with 969 additions and 181 deletions.
6 changes: 6 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,12 @@
- `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.

- `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}/<fontDirName>`, where `<fontDirName>` can be found in
the upstream [`fonts.json`](https://github.com/ryanoasis/nerd-fonts/blob/master/bin/scripts/lib/fonts.json)
as the `patchedName` properties, with whitespaces (if any) trimmed.

## Other Notable Changes {#sec-release-24.11-notable-changes}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
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 @@ -140,7 +140,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/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
64 changes: 64 additions & 0 deletions pkgs/data/fonts/nerd-fonts/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
lib,
stdenvNoCC,
fetchzip,
}:

let
releaseVersion = lib.trivial.importJSON ./release-version.json;
makeNerdFont =
{
pname,
dirName,
originalName,
declaresRFN,
version,
longDescription,
license,
url,
sha256,
...
}:
stdenvNoCC.mkDerivation {
inherit pname version;

src = fetchzip {
inherit url sha256;
stripRoot = false;
};

installPhase = ''
runHook preInstall
dst_opentype=$out/share/fonts/opentype/${dirName}
dst_truetype=$out/share/fonts/truetype/${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 = ./update.sh;
inherit originalName declaresRFN;
};

meta = {
inherit longDescription license;
homepage = "https://nerdfonts.com/";
changelog = "https://github.com/ryanoasis/nerd-fonts/blob/v${releaseVersion}/changelog.md";
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [
doronbehar
rc-zb
];
};
};
in

builtins.listToAttrs (
map (font: lib.attrsets.nameValuePair font.attrName (makeNerdFont font)) (
lib.trivial.importJSON ./fonts.json
)
)
Loading

0 comments on commit bfc0b4f

Please sign in to comment.