1{
2 lib,
3 stdenvNoCC,
4 fetchzip,
5 useVariableFont ? true,
6}:
7
8stdenvNoCC.mkDerivation (finalAttrs: {
9 pname = "fira-code";
10 version = "6.2";
11
12 src = fetchzip {
13 url = "https://github.com/tonsky/FiraCode/releases/download/${finalAttrs.version}/Fira_Code_v${finalAttrs.version}.zip";
14 stripRoot = false;
15 hash = "sha256-UHOwZL9WpCHk6vZaqI/XfkZogKgycs5lWg1p0XdQt0A=";
16 };
17
18 # only extract the variable font because everything else is a duplicate
19 installPhase = ''
20 runHook preInstall
21
22 install -Dm644 -t $out/share/fonts/truetype ${
23 if useVariableFont then "variable_ttf/*-VF.ttf" else "ttf/*.ttf"
24 }
25
26 runHook postInstall
27 '';
28
29 meta = with lib; {
30 homepage = "https://github.com/tonsky/FiraCode";
31 description = "Monospace font with programming ligatures";
32 longDescription = ''
33 Fira Code is a monospace font extending the Fira Mono font with
34 a set of ligatures for common programming multi-character
35 combinations.
36 '';
37 license = licenses.ofl;
38 maintainers = [ maintainers.rycee ];
39 platforms = platforms.all;
40 };
41})