1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ lib, pkgs, ... }:
let
adwaita-fonts-nerd = pkgs.stdenvNoCC.mkDerivation {
pname = "adwaita-fonts-nerd";
version = "1.8.0-${pkgs.nerd-font-patcher.version}";
src = pkgs.adwaita-fonts;
nativeBuildInputs = [
pkgs.nerd-font-patcher
]
++ (with pkgs.python3Packages; [
python
fontforge
]);
buildPhase = ''
runHook preBuild
mkdir -p build/
for f in share/fonts/Adwaita/*; do
nerd-font-patcher $f --complete --no-progressbars --outputdir build
# note: this will *not* return an error exit code on failure, but instead
# write out a corrupt file, so an additional check phase is required
done
runHook postBuild
'';
doCheck = true;
checkPhase = ''
runHook preCheck
# Try to open each font. If a corrupt font was written out, this should fail
for f in build/*; do
fontforge - <<EOF
try:
fontforge.open(''\'''${f}')
except:
exit(1)
EOF
done
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/fonts/opentype/
install -Dm 444 build/* $out/share/fonts/opentype/
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/ryanoasis/nerd-fonts";
description = "Adwaita Fonts patched with Nerd Fonts icons";
license = licenses.ofl;
platforms = platforms.all;
};
};
in
{
fonts.fontconfig = {
enable = true;
defaultFonts = {
serif = [ "Adwaita Sans" ];
sansSerif = [ "Adwaita Sans" ];
monospace = [ "Adwaita Mono" ];
emoji = [ "Noto Color Emoji" ];
};
};
home.packages = with pkgs; [
adwaita-fonts-nerd
liberation_ttf
ttf_bitstream_vera
noto-fonts
noto-fonts-emoji
nerd-fonts.symbols-only
fira-code
fira-mono
];
}