lol
1{ lib, stdenv, fetchurl, cabextract }:
2
3let
4 fonts = [
5 { name = "andale"; sha256 = "0w7927hlwayqf3vvanf8f3qp2g1i404jzqvhp1z3mp0sjm1gw905"; }
6 { name = "arial"; sha256 = "1xkqyivbyb3z9dcalzidf8m4npzfpls2g0kldyn8g73f2i6plac5"; }
7 { name = "arialb"; sha256 = "1a60zqrg63kjnykh5hz7dbpzvx7lyivn3vbrp7jyv9d1nvzz09d4"; }
8 { name = "comic"; sha256 = "0ki0rljjc1pxkbsxg515fwx15yc95bdyaksa3pjd89nyxzzg6vcw"; }
9 { name = "courie"; sha256 = "111k3waxki9yyxpjwl2qrdkswvsd2dmvhbjmmrwyipam2s31sldv"; }
10 { name = "georgi"; sha256 = "0083jcpd837j2c06kp1q8glfjn9k7z6vg3wi137savk0lv6psb1c"; }
11 { name = "impact"; sha256 = "1yyc5z7zmm3s418hmrkmc8znc55afsrz5dgxblpn9n81fhxyyqb0"; }
12 { name = "times"; sha256 = "1aq7z3l46vwgqljvq9zfgkii6aivy00z1529qbjkspggqrg5jmnv"; }
13 { name = "trebuc"; sha256 = "1jfsgz80pvyqvpfpaiz5pd8zwlcn67rg2jgynjwf22sip2dhssas"; }
14 { name = "webdin"; sha256 = "0nnp2znmnmx87ijq9zma0vl0hd46npx38p0cc6lgp00hpid5nnb4"; }
15 { name = "verdan"; sha256 = "15mdbbfqbyp25a6ynik3rck3m3mg44plwrj79rwncc9nbqjn3jy1"; }
16 { name = "wd97vwr"; sha256 = "1lmkh3zb6xv47k0z2mcwk3vk8jff9m845c9igxm14bbvs6k2c4gn"; }
17 ];
18
19 eula = fetchurl {
20 url = "http://corefonts.sourceforge.net/eula.htm";
21 sha256 = "1aqbcnl032g2hd7iy56cs022g47scb0jxxp3mm206x1yqc90vs1c";
22 };
23in
24stdenv.mkDerivation {
25 pname = "corefonts";
26 version = "1";
27
28 exes = map ({name, sha256}: fetchurl {
29 url = "mirror://sourceforge/corefonts/${name}32.exe";
30 inherit sha256;
31 }) fonts;
32
33 nativeBuildInputs = [ cabextract ];
34
35 buildCommand = ''
36 for i in $exes; do
37 cabextract --lowercase $i
38 done
39 cabextract --lowercase viewer1.cab
40
41 # rename to more standard names
42 mv andalemo.ttf Andale_Mono.ttf
43 mv ariblk.ttf Arial_Black.ttf
44 mv arial.ttf Arial.ttf
45 mv arialbd.ttf Arial_Bold.ttf
46 mv arialbi.ttf Arial_Bold_Italic.ttf
47 mv ariali.ttf Arial_Italic.ttf
48 mv comic.ttf Comic_Sans_MS.ttf
49 mv comicbd.ttf Comic_Sans_MS_Bold.ttf
50 mv cour.ttf Courier_New.ttf
51 mv courbd.ttf Courier_New_Bold.ttf
52 mv couri.ttf Courier_New_Italic.ttf
53 mv courbi.ttf Courier_New_Bold_Italic.ttf
54 mv georgia.ttf Georgia.ttf
55 mv georgiab.ttf Georgia_Bold.ttf
56 mv georgiai.ttf Georgia_Italic.ttf
57 mv georgiaz.ttf Georgia_Bold_Italic.ttf
58 mv impact.ttf Impact.ttf
59 mv tahoma.ttf Tahoma.ttf
60 mv times.ttf Times_New_Roman.ttf
61 mv timesbd.ttf Times_New_Roman_Bold.ttf
62 mv timesbi.ttf Times_New_Roman_Bold_Italic.ttf
63 mv timesi.ttf Times_New_Roman_Italic.ttf
64 mv trebuc.ttf Trebuchet_MS.ttf
65 mv trebucbd.ttf Trebuchet_MS_Bold.ttf
66 mv trebucit.ttf Trebuchet_MS_Italic.ttf
67 mv trebucbi.ttf Trebuchet_MS_Italic.ttf
68 mv verdana.ttf Verdana.ttf
69 mv verdanab.ttf Verdana_Bold.ttf
70 mv verdanai.ttf Verdana_Italic.ttf
71 mv verdanaz.ttf Verdana_Bold_Italic.ttf
72 mv webdings.ttf Webdings.ttf
73
74 install -m444 -Dt $out/share/fonts/truetype *.ttf
75
76 # Also put the EULA there to be on the safe side.
77 cp ${eula} $out/share/fonts/truetype/eula.html
78
79 # Set up no-op font configs to override any aliases set up by other packages.
80 mkdir -p $out/etc/fonts/conf.d
81 for name in Andale-Mono Arial-Black Arial Comic-Sans-MS \
82 Courier-New Georgia Impact Times-New-Roman \
83 Trebuchet Verdana Webdings ; do
84 substitute ${./no-op.conf} $out/etc/fonts/conf.d/30-''${name,,}.conf \
85 --subst-var-by fontname "''${name//-/ }"
86 done
87 '';
88
89 meta = with lib; {
90 homepage = "http://corefonts.sourceforge.net/";
91 description = "Microsoft's TrueType core fonts for the Web";
92 platforms = platforms.all;
93 license = licenses.unfreeRedistributable;
94 # Set a non-zero priority to allow easy overriding of the
95 # fontconfig configuration files.
96 priority = 5;
97 };
98}