Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 148 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 unzip, 5 fetchurl, 6}: 7 8let 9 10 hashes = lib.importJSON ./hashes.json; 11 12 maple-font = 13 { 14 pname, 15 hash, 16 desc, 17 }: 18 stdenv.mkDerivation rec { 19 inherit pname; 20 version = "7.4"; 21 src = fetchurl { 22 url = "https://github.com/subframe7536/Maple-font/releases/download/v${version}/${pname}.zip"; 23 inherit hash; 24 }; 25 26 # Work around the "unpacker appears to have produced no directories" 27 # case that happens when the archive doesn't have a subdirectory. 28 sourceRoot = "."; 29 nativeBuildInputs = [ unzip ]; 30 installPhase = '' 31 find . -name '*.ttf' -exec install -Dt $out/share/fonts/truetype {} \; 32 find . -name '*.otf' -exec install -Dt $out/share/fonts/opentype {} \; 33 find . -name '*.woff2' -exec install -Dt $out/share/fonts/woff2 {} \; 34 ''; 35 36 meta = with lib; { 37 homepage = "https://github.com/subframe7536/Maple-font"; 38 description = '' 39 Open source ${desc} font with round corner and ligatures for IDE and command line 40 ''; 41 license = licenses.ofl; 42 platforms = platforms.all; 43 maintainers = with maintainers; [ oluceps ]; 44 }; 45 }; 46 47 typeVariants = { 48 truetype = { 49 suffix = "TTF"; 50 desc = "monospace TrueType"; 51 }; 52 53 truetype-autohint = { 54 suffix = "TTF-AutoHint"; 55 desc = "monospace ttf autohint"; 56 }; 57 58 variable = { 59 suffix = "Variable"; 60 desc = "monospace variable"; 61 }; 62 63 woff2 = { 64 suffix = "Woff2"; 65 desc = "WOFF2.0"; 66 }; 67 68 opentype = { 69 suffix = "OTF"; 70 desc = "OpenType"; 71 }; 72 73 NF = { 74 suffix = "NF"; 75 desc = "Nerd Font"; 76 }; 77 78 NF-unhinted = { 79 suffix = "NF-unhinted"; 80 desc = "Nerd Font unhinted"; 81 }; 82 83 CN = { 84 suffix = "CN"; 85 desc = "monospace CN"; 86 }; 87 88 CN-unhinted = { 89 suffix = "CN-unhinted"; 90 desc = "monospace CN unhinted"; 91 }; 92 93 NF-CN = { 94 suffix = "NF-CN"; 95 desc = "Nerd Font CN"; 96 }; 97 98 NF-CN-unhinted = { 99 suffix = "NF-CN-unhinted"; 100 desc = "Nerd Font CN unhinted"; 101 }; 102 }; 103 104 ligatureVariants = { 105 No-Ligature = { 106 suffix = "NL"; 107 desc = "No Ligature"; 108 }; 109 Normal-Ligature = { 110 suffix = "Normal"; 111 desc = "Normal Ligature"; 112 }; 113 Normal-No-Ligature = { 114 suffix = "NormalNL"; 115 desc = "Normal No Ligature"; 116 }; 117 }; 118 119 combinedFonts = 120 lib.concatMapAttrs ( 121 ligName: ligVariant: 122 lib.concatMapAttrs ( 123 typeName: typeVariant: 124 let 125 pname = "MapleMono${ligVariant.suffix}-${typeVariant.suffix}"; 126 in 127 { 128 "${ligVariant.suffix}-${typeVariant.suffix}" = maple-font { 129 inherit pname; 130 desc = "${ligVariant.desc} ${typeVariant.desc}"; 131 hash = hashes.${pname}; 132 }; 133 } 134 ) typeVariants 135 ) ligatureVariants 136 // lib.mapAttrs ( 137 _: value: 138 let 139 pname = "MapleMono-${value.suffix}"; 140 in 141 maple-font { 142 inherit pname; 143 inherit (value) desc; 144 hash = hashes.${pname}; 145 } 146 ) typeVariants; 147in 148combinedFonts