btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / no / noto-fonts / package.nix
blobb47072549b24b948029b0b3dfef84bfd9a75d585
1 { lib
2 , stdenvNoCC
3 , fetchFromGitHub
4 , gitUpdater
5 , nixosTests
6 , variants ? [ ]
7 , suffix ? ""
8 , longDescription ? ''
9     When text is rendered by a computer, sometimes characters are
10     displayed as “tofu”. They are little boxes to indicate your device
11     doesn’t have a font to display the text.
12     Google has been developing a font family called Noto, which aims to
13     support all languages with a harmonious look and feel. Noto is
14     Google’s answer to tofu. The name noto is to convey the idea that
15     Google’s goal is to see “no more tofu”.  Noto has multiple styles and
16     weights, and freely available to all.
17   ''
20 stdenvNoCC.mkDerivation rec {
21   pname = "noto-fonts${suffix}";
22   version = "24.3.1";
24   src = fetchFromGitHub {
25     owner = "notofonts";
26     repo = "notofonts.github.io";
27     rev = "noto-monthly-release-${version}";
28     hash = "sha256-bopBRpIGXtRyAjBuMhJCjwFUlK8WDurxIFbZbRzEE40=";
29   };
31   _variants = map (variant: builtins.replaceStrings [ " " ] [ "" ] variant) variants;
33   installPhase = ''
34     # We check availability in order of variable -> otf -> ttf
35     # unhinted -- the hinted versions use autohint
36     # maintaining maximum coverage.
37     #
38     # We have a mix of otf and ttf fonts
39     local out_font=$out/share/fonts/noto
40   '' + (if _variants == [ ] then ''
41     for folder in $(ls -d fonts/*/); do
42       if [[ -d "$folder"unhinted/variable-ttf ]]; then
43         install -m444 -Dt $out_font "$folder"unhinted/variable-ttf/*.ttf
44       elif [[ -d "$folder"unhinted/otf ]]; then
45         install -m444 -Dt $out_font "$folder"unhinted/otf/*.otf
46       else
47         install -m444 -Dt $out_font "$folder"unhinted/ttf/*.ttf
48       fi
49     done
50   '' else ''
51     for variant in $_variants; do
52       if [[ -d fonts/"$variant"/unhinted/variable-ttf ]]; then
53         install -m444 -Dt $out_font fonts/"$variant"/unhinted/variable-ttf/*.ttf
54       elif [[ -d fonts/"$variant"/unhinted/otf ]]; then
55         install -m444 -Dt $out_font fonts/"$variant"/unhinted/otf/*.otf
56       else
57         install -m444 -Dt $out_font fonts/"$variant"/unhinted/ttf/*.ttf
58       fi
59     done
60   '');
62   passthru.updateScript = gitUpdater {
63     rev-prefix = "noto-monthly-release-";
64   };
66   passthru.tests = { inherit (nixosTests) noto-fonts; };
68   meta = {
69     description = "Beautiful and free fonts for many languages";
70     homepage = "https://www.google.com/get/noto/";
71     inherit longDescription;
72     license = lib.licenses.ofl;
73     platforms = lib.platforms.all;
74     maintainers = with lib.maintainers; [ mathnerd314 emily jopejoe1 ];
75   };