nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchzip
4, python3
5, config
6, acceptLicense ? config.input-fonts.acceptLicense or false
7}:
8
9let
10
11 throwLicense = throw ''
12 Input is available free of charge for private/unpublished usage. This includes things like your personal coding app or for composing plain text documents.
13 To use it, you need to agree to its license: https://input.djr.com/license/
14
15 You can express acceptance by setting acceptLicense to true in your
16 configuration. Note that this is not a free license so it requires allowing
17 unfree licenses.
18
19 configuration.nix:
20 nixpkgs.config.allowUnfree = true;
21 nixpkgs.config.input-fonts.acceptLicense = true;
22
23 config.nix:
24 allowUnfree = true;
25 input-fonts.acceptLicense = true;
26
27 If you would like to support this project, consider purchasing a license at <http://input.djr.com/buy>.
28 '';
29
30 releaseDate = "2015-06-24";
31
32in
33
34stdenv.mkDerivation rec {
35 pname = "input-fonts";
36 version = "1.2";
37
38 src =
39 assert !acceptLicense -> throwLicense;
40 fetchzip {
41 name = "input-fonts-${version}";
42 # Add .zip parameter so that zip unpackCmd can match it.
43 url = "https://input.djr.com/build/?fontSelection=whole&a=0&g=0&i=0&l=0&zero=0&asterisk=0&braces=0&preset=default&line-height=1.2&accept=I+do&email=&.zip";
44 sha256 = "BESZ4Bjgm2hvQ7oPpMvYSlE8EqvQjqHZtXWIovqyIzA=";
45 stripRoot = false;
46
47 postFetch = ''
48 # Reset the timestamp to release date for determinism.
49 PATH=${lib.makeBinPath [ python3.pkgs.fonttools ]}:$PATH
50 for ttf_file in $out/Input_Fonts/*/*/*.ttf; do
51 ttx_file=$(dirname "$ttf_file")/$(basename "$ttf_file" .ttf).ttx
52 ttx "$ttf_file"
53 rm "$ttf_file"
54 touch -m -t ${builtins.replaceStrings [ "-" ] [ "" ] releaseDate}0000 "$ttx_file"
55 ttx --recalc-timestamp "$ttx_file"
56 rm "$ttx_file"
57 done
58 '';
59 };
60
61 dontConfigure = true;
62 dontBuild = true;
63
64 installPhase = ''
65 runHook preInstall
66
67 mkdir -p $out/share/fonts/truetype
68 find Input_Fonts -name "*.ttf" -exec cp -a {} "$out"/share/fonts/truetype/ \;
69 mkdir -p "$out"/share/doc
70 cp -a *.txt "$out"/share/doc/
71
72 runHook postInstall
73 '';
74
75 meta = with lib; {
76 description = "Fonts for Code, from Font Bureau";
77 longDescription = ''
78 Input is a font family designed for computer programming, data,
79 and text composition. It was designed by David Jonathan Ross
80 between 2012 and 2014 and published by The Font Bureau. It
81 contains a wide array of styles so you can fine-tune the
82 typography that works best in your editing environment.
83
84 Input Mono is a monospaced typeface, where all characters occupy
85 a fixed width. Input Sans and Serif are proportional typefaces
86 that are designed with all of the features of a good monospace —
87 generous spacing, large punctuation, and easily distinguishable
88 characters — but without the limitations of a fixed width.
89 '';
90 homepage = "https://input.djr.com/";
91 license = licenses.unfree;
92 maintainers = with maintainers; [
93 jtojnar
94 romildo
95 ];
96 platforms = platforms.all;
97 };
98}