default.nix 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. {
  2. stdenv,
  3. lib,
  4. buildNpmPackage,
  5. fetchFromGitHub,
  6. darwin,
  7. remarshal,
  8. ttfautohint-nox,
  9. privateBuildPlan ? ''
  10. [buildPlans.IosevkaQ]
  11. family = "Iosevka q"
  12. spacing = "term"
  13. serifs = "sans"
  14. noCvSs = true
  15. exportGlyphNames = false
  16. [buildPlans.IosevkaQ.variants]
  17. inherits = "ss14"
  18. [buildPlans.IosevkaQ.variants.design]
  19. capital-l = "serifless"
  20. capital-q = "straight"
  21. capital-z = "straight-serifless"
  22. l = "serifed-flat-tailed"
  23. z = "straight-serifless"
  24. lower-alpha = "crossing"
  25. zero = "tall-slashed"
  26. punctuation-dot = "round"
  27. tilde = "low"
  28. asterisk = "penta-low"
  29. underscore = "high"
  30. caret = "medium"
  31. ascii-grave = "straight"
  32. ascii-single-quote = "straight"
  33. paren = "flat-arc"
  34. brace = "curly-flat-boundary"
  35. guillemet = "straight"
  36. number-sign = "slanted"
  37. at = "fourfold"
  38. dollar = "through"
  39. cent = "through"
  40. percent = "rings-segmented-slash"
  41. bar = "natural-slope"
  42. question = "smooth"
  43. lig-ltgteq = "slanted"
  44. lig-neq = "slightly-slanted"
  45. lig-equal-chain = "without-notch"
  46. lig-hyphen-chain = "without-notch"
  47. lig-plus-chain = "without-notch"
  48. lig-double-arrow-bar = "without-notch"
  49. lig-single-arrow-bar = "without-notch"
  50. [buildPlans.IosevkaQ.variants.italic]
  51. capital-l = "serifless"
  52. capital-q = "straight"
  53. capital-z = "straight-serifless"
  54. l = "serifed-flat-tailed"
  55. z = "straight-serifless"
  56. lower-alpha = "crossing"
  57. zero = "tall-slashed"
  58. punctuation-dot = "round"
  59. tilde = "low"
  60. asterisk = "penta-low"
  61. underscore = "high"
  62. caret = "medium"
  63. ascii-grave = "straight"
  64. ascii-single-quote = "straight"
  65. paren = "flat-arc"
  66. brace = "curly-flat-boundary"
  67. guillemet = "straight"
  68. number-sign = "slanted"
  69. at = "fourfold"
  70. dollar = "through"
  71. cent = "through"
  72. percent = "rings-segmented-slash"
  73. bar = "natural-slope"
  74. question = "smooth"
  75. lig-ltgteq = "slanted"
  76. lig-neq = "slightly-slanted"
  77. lig-equal-chain = "without-notch"
  78. lig-hyphen-chain = "without-notch"
  79. lig-plus-chain = "without-notch"
  80. lig-double-arrow-bar = "without-notch"
  81. lig-single-arrow-bar = "without-notch"
  82. [buildPlans.IosevkaQ.variants.oblique]
  83. capital-l = "serifless"
  84. capital-q = "straight"
  85. capital-z = "straight-serifless"
  86. l = "serifed-flat-tailed"
  87. z = "straight-serifless"
  88. lower-alpha = "crossing"
  89. zero = "tall-slashed"
  90. punctuation-dot = "round"
  91. tilde = "low"
  92. asterisk = "penta-low"
  93. underscore = "high"
  94. caret = "medium"
  95. ascii-grave = "straight"
  96. ascii-single-quote = "straight"
  97. paren = "flat-arc"
  98. brace = "curly-flat-boundary"
  99. guillemet = "straight"
  100. number-sign = "slanted"
  101. at = "fourfold"
  102. dollar = "through"
  103. cent = "through"
  104. percent = "rings-segmented-slash"
  105. bar = "natural-slope"
  106. question = "smooth"
  107. lig-ltgteq = "slanted"
  108. lig-neq = "slightly-slanted"
  109. lig-equal-chain = "without-notch"
  110. lig-hyphen-chain = "without-notch"
  111. lig-plus-chain = "without-notch"
  112. lig-double-arrow-bar = "without-notch"
  113. lig-single-arrow-bar = "without-notch"
  114. [buildPlans.IosevkaQ.ligations]
  115. inherits = "dlig"
  116. '',
  117. extraParameters ? null,
  118. set ? "Q",
  119. }:
  120. assert (privateBuildPlan != null) -> set != null;
  121. assert (extraParameters != null) -> set != null;
  122. buildNpmPackage rec {
  123. pname = if set != null then "Iosevka${set}" else "Iosevka";
  124. version = "28.0.7";
  125. src = fetchFromGitHub {
  126. owner = "be5invis";
  127. repo = "iosevka";
  128. rev = "v${version}";
  129. hash = "sha256-kNesR+t+ybY9XFWBhXJJKxG4D32B8eCjMnCBb7OIEWs=";
  130. };
  131. npmDepsHash = "sha256-V9/83fX1hEHTQYhypru4slWMA+7h/Qq/TPhhKUNU7G8=";
  132. nativeBuildInputs =
  133. [
  134. remarshal
  135. ttfautohint-nox
  136. ]
  137. ++ lib.optionals stdenv.isDarwin [
  138. # libtool
  139. darwin.cctools
  140. ];
  141. buildPlan =
  142. if builtins.isAttrs privateBuildPlan then
  143. builtins.toJSON { buildPlans.${pname} = privateBuildPlan; }
  144. else
  145. privateBuildPlan;
  146. inherit extraParameters;
  147. passAsFile =
  148. [ "extraParameters" ]
  149. ++ lib.optionals (
  150. !(builtins.isString privateBuildPlan && lib.hasPrefix builtins.storeDir privateBuildPlan)
  151. ) [ "buildPlan" ];
  152. configurePhase = ''
  153. runHook preConfigure
  154. ${lib.optionalString (builtins.isAttrs privateBuildPlan) ''
  155. remarshal -i "$buildPlanPath" -o private-build-plans.toml -if json -of toml
  156. ''}
  157. ${lib.optionalString
  158. (builtins.isString privateBuildPlan && (!lib.hasPrefix builtins.storeDir privateBuildPlan))
  159. ''
  160. cp "$buildPlanPath" private-build-plans.toml
  161. ''
  162. }
  163. ${lib.optionalString
  164. (builtins.isString privateBuildPlan && (lib.hasPrefix builtins.storeDir privateBuildPlan))
  165. ''
  166. cp "$buildPlan" private-build-plans.toml
  167. ''
  168. }
  169. ${lib.optionalString (extraParameters != null) ''
  170. echo -e "\n" >> params/parameters.toml
  171. cat "$extraParametersPath" >> params/parameters.toml
  172. ''}
  173. runHook postConfigure
  174. '';
  175. buildPhase = ''
  176. export HOME=$TMPDIR
  177. runHook preBuild
  178. npm run build --no-update-notifier -- --jCmd=$NIX_BUILD_CORES --verbose=9 ttf::$pname
  179. runHook postBuild
  180. '';
  181. installPhase = ''
  182. runHook preInstall
  183. fontdir="$out/share/fonts/truetype"
  184. install -d "$fontdir"
  185. install "dist/$pname/TTF"/* "$fontdir"
  186. runHook postInstall
  187. '';
  188. enableParallelBuilding = true;
  189. meta = with lib; {
  190. homepage = "https://typeof.net/Iosevka/";
  191. downloadPage = "https://github.com/be5invis/Iosevka/releases";
  192. description = "Versatile typeface for code, from code.";
  193. longDescription = ''
  194. Iosevka is an open-source, sans-serif + slab-serif, monospace +
  195. quasi‑proportional typeface family, designed for writing code, using in
  196. terminals, and preparing technical documents.
  197. '';
  198. license = licenses.ofl;
  199. platforms = platforms.all;
  200. maintainers = with maintainers; [ ludovicopiero ];
  201. };
  202. }