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