full rewrite, first commit
This commit is contained in:
commit
a83c37a638
24 changed files with 4358 additions and 0 deletions
77
modules/nixos/system/fonts/default.nix
Normal file
77
modules/nixos/system/fonts/default.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.${namespace};
|
||||
let
|
||||
cfg = config.${namespace}.system.fonts;
|
||||
in
|
||||
{
|
||||
options.${namespace}.system.fonts = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to manage fonts.";
|
||||
emoji = mkBoolOpt false "Whether or not to enable emojis.";
|
||||
fonts = mkOpt (listOf package) [ ] "Custom font packages to install.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.variables = {
|
||||
LOG_ICONS = "true";
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ font-manager ];
|
||||
|
||||
fonts = {
|
||||
fontconfig = mkIf cfg.emoji {
|
||||
enable = true;
|
||||
localConf = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<alias binding="weak">
|
||||
<family>monospace</family>
|
||||
<prefer>
|
||||
<family>emoji</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
<alias binding="weak">
|
||||
<family>sans-serif</family>
|
||||
<prefer>
|
||||
<family>emoji</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
<alias binding="weak">
|
||||
<family>serif</family>
|
||||
<prefer>
|
||||
<family>emoji</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
</fontconfig>
|
||||
'';
|
||||
defaultFonts = {
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
monospace = [ "FreeMono" ];
|
||||
sansSerif = [ "FreeSans" ];
|
||||
serif = [ "FreeSerif" ];
|
||||
};
|
||||
};
|
||||
|
||||
packages =
|
||||
with pkgs;
|
||||
[
|
||||
twemoji-color-font
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-cjk-serif
|
||||
noto-fonts-emoji
|
||||
(nerdfonts.override { fonts = [ "Hack" ]; })
|
||||
]
|
||||
++ cfg.fonts;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue