-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
55 lines (53 loc) · 1.75 KB
/
flake.nix
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
{
description = "Fonts for the Toaq language";
inputs.flake-utils.url = github:numtide/flake-utils;
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mkBuildPhase = fontNames:
let
names = pkgs.lib.strings.concatMapStringsSep
" " (name: "\"${name}\"") fontNames;
in ''
for font in ${names}; do
fontforge -lang=ff -c \
'Open($1); Generate($2); Generate($3); Generate($4)' \
"$font.sfd" "$font.otf" "$font.ttf" "$font.woff2"
done
'';
installPhase = ''
mkdir -p $out/share/fonts/{opentype,truetype,woff2}
mv *.otf $out/share/fonts/opentype
mv *.ttf $out/share/fonts/truetype
mv *.woff2 $out/share/fonts/woff2
'';
derani = pkgs.stdenv.mkDerivation {
name = "derani";
src = self;
buildInputs = [ pkgs.fontforge-fonttools ];
buildPhase = mkBuildPhase [ "Derani Bold" "Derani Regular" "Guezueq" "Juitaq" "Neajiaq" ];
inherit installPhase;
};
latin = pkgs.stdenv.mkDerivation {
name = "latin";
src = self;
buildInputs = [ pkgs.fontforge-fonttools ];
buildPhase = mkBuildPhase [
"Commissioner Medium"
"Commissioner Bold"
];
inherit installPhase;
};
allPkgs = { inherit derani latin; };
in {
packages = allPkgs // {
all = pkgs.symlinkJoin {
name = "all";
paths = builtins.attrValues allPkgs;
};
};
defaultPackage = self.packages.${system}.all;
}
);
}