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

36 lines
1.1 KiB
Nix
Raw Normal View History

2020-04-26 13:29:23 +00:00
{ config, pkgs, lib, ... }: {
2019-07-23 17:19:33 +00:00
fonts = {
fontconfig = {
enable = true;
cache32Bit = true;
defaultFonts = {
2020-04-11 20:39:52 +00:00
monospace = [ "Jetbrains Mono" "DejaVu Sans Mono" ];
sansSerif = [ "B612" "DejaVu Sans" ];
2019-07-23 17:19:33 +00:00
serif = [ "Roboto Slab Regular" "DejaVu Serif" ];
};
};
enableDefaultFonts = true;
enableFontDir = true;
2019-07-31 20:36:41 +00:00
fonts = builtins.attrValues {
inherit (pkgs)
2020-04-11 20:39:52 +00:00
nerdfonts # emojis
libertine # because I like them
roboto # serif font
font-awesome # icons I guess?
material-icons # icons in my app
b612 # sans font
2020-04-26 13:29:23 +00:00
jetbrains-mono; # code font
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
environment.etc = let
# fonts with src attributes
font_sources = map (v: v.src) (lib.filter (v: v ? src) config.fonts.fonts);
2019-09-15 19:10:15 +00:00
in builtins.listToAttrs (lib.imap0 (n: v:
2019-07-31 21:56:52 +00:00
lib.nameValuePair "src-cache/fonts/${toString n}" {
source = builtins.toPath v;
}) font_sources);
2019-07-23 17:19:33 +00:00
}