config/modules/nixos/ui/fonts/default.nix

142 lines
3.9 KiB
Nix
Raw Normal View History

2024-05-23 20:26:30 +00:00
{
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.ui.fonts;
in {
options.ui.fonts = with types; {
enable = mkBoolOpt false "Enable Custom Fonts";
};
config = mkIf cfg.enable {
fonts = {
packages = with pkgs; [
material-icons
material-design-icons
roboto
work-sans
comic-neue
source-sans
twemoji-color-font
comfortaa
inter
lato
lexend
jost
dejavu_fonts
2025-01-07 18:42:17 +00:00
iosevka
2025-01-12 13:37:57 -05:00
cantarell-fonts
2025-01-19 15:04:19 -05:00
# (let
# bolder = writeText "bolder.py" ''
# #!/usr/bin/env python
# # Script shamelessly stolen from: https://github.com/shytikov/pragmasevka
#
# import sys
# import fontforge
#
# if len(sys.argv) < 2:
# print("Please provide path prefix of the font to update!")
# exit()
#
# prefix = sys.argv[1]
#
# glyphs = [
# "exclam", "ampersand", "parenleft", "parenright", "asterisk", "plus",
# "comma", "hyphen", "period", "slash", "colon", "semicolon", "less",
# "equal", "greater", "question", "bracketleft", "backslash", "bracketright",
# "asciicircum", "braceleft", "bar", "braceright", "asciitilde",
# ]
#
# pairs = [
# ['regular', 'semibold'],
# ['regularItalic', 'semiboldItalic'],
# ['bold', 'black'],
# ['boldItalic', 'blackItalic'],
# ]
#
# for [recipient, donor] in pairs:
# font = f"{prefix}{recipient}.ttf"
# donor_font = f"{prefix}{donor}.ttf"
#
# target = fontforge.open(font)
# # Finding all punctuation
# target.selection.select(*glyphs)
# # and deleting it to make space
# for i in target.selection.byGlyphs:
# target.removeGlyph(i)
#
# source = fontforge.open(donor_font)
# source.selection.select(*glyphs)
# source.copy()
# target.paste()
#
# target.generate(font)
# '';
# in (iosevka.override
# {
# set = "Custom";
# privateBuildPlan = ''
# [buildPlans.IosevkaCustom]
# family = "Iosevka"
# spacing = "normal"
# serifs = "sans"
# noCvSs = true
# exportGlyphNames = true
2025-01-07 18:42:17 +00:00
#
# [buildPlans.IosevkaCustom.variants]
2025-01-19 15:04:19 -05:00
# inherits = "ss08"
# '';
# }))
# .overrideAttrs (oldAttrs: {
# buildInputs =
# (oldAttrs.buildInputs or [])
# ++ [
# pkgs.python3
# pkgs.python3Packages.fontforge
# ];
#
# postInstall = ''
# ${oldAttrs.postInstall or ""}
#
# echo $out
#
# cd $out/share/fonts/truetype
#
# PREFIX="IosevkaCustom-normal"
#
# python3 ${bolder} $PREFIX
2025-01-07 18:42:17 +00:00
# '';
2025-01-19 15:04:19 -05:00
# }))
2024-05-23 20:26:30 +00:00
noto-fonts
2024-10-31 21:01:42 -04:00
noto-fonts-cjk-sans
2024-05-23 20:26:30 +00:00
noto-fonts-emoji
jetbrains-mono
2024-12-16 16:39:20 -05:00
nerd-fonts.iosevka
2025-01-19 15:04:19 -05:00
nerd-fonts.zed-mono
2024-12-16 16:39:20 -05:00
# (nerdfonts.override {fonts = ["ZedMono" "Iosevka"];})
2024-05-23 20:26:30 +00:00
];
enableDefaultPackages = false;
# this fixes emoji stuff
fontconfig = {
defaultFonts = {
monospace = [
2025-01-19 15:04:19 -05:00
"Pragmata Pro Mono"
# "Iosevka"
2024-05-23 20:26:30 +00:00
"Noto Color Emoji"
];
2025-01-12 13:37:57 -05:00
sansSerif = ["Cantarell" "Noto Color Emoji"];
2024-05-23 20:26:30 +00:00
serif = ["Noto Serif" "Noto Color Emoji"];
emoji = ["Noto Color Emoji"];
};
};
};
};
}