nixos-config/modules/fonts.nix
Simon Bruder 10b8d432d5
Relicense
This applies the REUSE specification to the repository, so the licensing
information can be tracked for every file individually.
2024-01-13 14:39:22 +01:00

123 lines
3.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SPDX-FileCopyrightText: 2020-2023 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, pkgs, ... }:
let
iosevka-sbruder = pkgs.iosevka.override {
privateBuildPlan = {
family = "Iosevka sbruder";
spacing = "term";
serifs = "sans";
no-cv-ss = false;
export-glyph-names = true;
variants = {
inherits = "ss20";
design = {
capital-g = "toothless-rounded-serifless-hooked";
four = "closed";
six = "closed-contour";
nine = "closed-contour";
number-sign = "upright-tall";
at = "compact";
cent = "open";
percent = "dots";
lig-ltgteq = "slanted";
};
};
weights = {
regular = {
shape = 400;
menu = 400;
css = 400;
};
bold = {
shape = 700;
menu = 700;
css = 700;
};
};
slopes = {
upright = {
angle = 0;
shape = "upright";
menu = "upright";
css = "normal";
};
italic = {
angle = 9.4;
shape = "italic";
menu = "italic";
css = "italic";
};
};
widths = {
# ensures that extended wont get built
normal = {
shape = 500;
menu = 5;
css = "normal";
};
};
};
set = "sbruder";
};
iosevka-sbruder-nerd-font = pkgs.runCommand "iosevka-sbruder-nerd-font" { } ''
${pkgs.parallel}/bin/parallel \
${pkgs.nerd-font-patcher}/bin/nerd-font-patcher \
--adjust-line-height \
--complete \
--careful \
--outputdir $out \
::: ${iosevka-sbruder}/share/fonts/truetype/*.ttf
'';
in
lib.mkIf config.sbruder.gui.enable {
fonts = {
packages = with pkgs; [
iosevka-sbruder-nerd-font
] ++ lib.optionals config.sbruder.full [
google-fonts # google font collection (free)
lmodern # Latin Modern for non-latex applications
noto-fonts-emoji-blob-bin # The most owo emojis (thanks google for killing them)
source-han-sans
source-han-serif # CJK fonts
] ++ lib.optionals (!config.sbruder.full) [
roboto # default sans-serif font (normally included in google-fonts)
] ++ lib.optionals config.sbruder.unfree.allowAssets [
corefonts # good ol microsoft fonts
vistafonts # newer microsoft fonts
];
enableDefaultPackages = true;
fontconfig = {
defaultFonts = {
emoji = [ "Blobmoji" ];
monospace = [ "IosevkaSbruder Nerd Font" "Source Han Sans" ];
sansSerif = [ "Roboto" "Source Han Sans" ];
serif = [ "Georgia" "Source Han Serif" ];
};
localConf = /* xml */ ''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<alias>
<family>system-ui</family>
<prefer>
<family>sans-serif</family>
</prefer>
</alias>
</fontconfig>
'';
};
};
}