I would like to use Apple's SF Mono font with nerd-fonts patches, but due to the license, it's not readily available.
This flake allows patching any1 system font and using it with nix-darwin.
Patching is performed by nerd-fonts. It only works on 1 subfamily, so I added a subfamily
parameter to extract the subfamily from the TTF with multiple variations. If your font doesn't contain any variations (fvar table), you can omit this parameter.
Add flake
{
inputs = {
# ...
font-patcher.url = "github:libc/nix-nerd-fonts-patcher";
};
# ...
}
Then use nix-darwin fonts module:
{ config, inputs, pkgs, system, ... }: {
config.fonts = {
fontDir.enable = true;
fonts = [
(inputs.font-patcher.lib.patchFont {
font = /System/Library/Fonts/SFNSMono.ttf;
name = "SF Mono Nerd Font - Regular";
subfamily = "Regular";
inherit system;
})
];
};
}
Footnotes
-
it was only tested on
SF Mono
โฉ