1
0
Fork 0
nixos-config/nixos/roles/fonts.nix

54 lines
1.3 KiB
Nix
Raw Normal View History

2022-03-08 01:42:46 +00:00
{
config,
pkgs,
lib,
...
}: {
2019-07-23 17:19:33 +00:00
fonts = {
fontconfig = {
enable = true;
cache32Bit = true;
2022-10-10 22:55:53 +00:00
defaultFonts = let
unicode-fallback = ["Noto Sans Symbols" "Noto Sans Symbols2"];
in {
monospace = ["JetBrainsMono Nerd Font" "Noto Sans Mono"] ++ unicode-fallback;
sansSerif = ["B612" "Noto Sans"] ++ unicode-fallback;
serif = ["Libertinus Serif" "Noto Serif"] ++ unicode-fallback;
2019-07-23 17:19:33 +00:00
};
};
2019-07-31 20:36:41 +00:00
fonts = builtins.attrValues {
2022-03-08 01:42:46 +00:00
inherit
(pkgs)
2022-11-22 15:25:54 +00:00
nerdfonts
# For all my terminal needs.
2022-11-25 10:55:12 +00:00
2022-11-22 15:25:54 +00:00
libertinus
# nice text font
2022-11-25 10:55:12 +00:00
2022-11-22 15:25:54 +00:00
material-icons
# icons in my app
2022-11-25 10:55:12 +00:00
2022-11-22 15:25:54 +00:00
b612
# sans font, very good for displays
2022-11-25 10:55:12 +00:00
2022-11-22 15:25:54 +00:00
noto-fonts
# for unicode fallback
2022-11-25 10:55:12 +00:00
2022-03-20 23:27:05 +00:00
;
2019-07-31 20:36:41 +00:00
};
2019-07-23 17:19:33 +00:00
};
# create a cache of the font sources, often slow internet connections make it painful to
# re-download them after a few months
2022-03-08 01:42:46 +00:00
environment.etc = let
# fonts with src attributes
font_sources = map (v: v.src) (lib.filter (v: v ? src) config.fonts.fonts);
in
2021-05-18 14:33:28 +00:00
builtins.listToAttrs (lib.imap0
2022-11-25 10:55:12 +00:00
(n: source:
lib.nameValuePair "src-cache/fonts/${toString n}" {
inherit source;
})
font_sources);
2019-07-23 17:19:33 +00:00
}