From 475124f78e4176696723f235c518e7f78331286f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 29 Aug 2016 20:21:32 +0200 Subject: [PATCH 1/4] dejavu_fonts: "symlink-split" a single font file See following commits for "why". --- pkgs/data/fonts/dejavu-fonts/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/data/fonts/dejavu-fonts/default.nix b/pkgs/data/fonts/dejavu-fonts/default.nix index f49f5c9bb007..6d9abdad2fa4 100644 --- a/pkgs/data/fonts/dejavu-fonts/default.nix +++ b/pkgs/data/fonts/dejavu-fonts/default.nix @@ -13,6 +13,8 @@ stdenv.mkDerivation rec { sha256 = "1xknlg2h287dx34v2n5r33bpcl4biqf0cv7nak657rjki7s0k4bk"; }; + outputs = [ "out" "minimal" ]; + buildFlags = "full-ttf"; preBuild = "patchShebangs scripts"; @@ -22,6 +24,10 @@ stdenv.mkDerivation rec { for i in $(find build -name '*.ttf'); do cp $i $out/share/fonts/truetype; done; + '' + '' + local fname=share/fonts/truetype/DejaVuSans.ttf + moveToOutput "$fname" "$minimal" + ln -s "$minimal/$fname" "$out/$fname" ''; meta = { From 3f80ecfc79e748ed29368342001592e2693a3138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 29 Aug 2016 22:27:34 +0200 Subject: [PATCH 2/4] fontforge: build the non-gui version without fontconfig (in build-time closure) --- pkgs/tools/misc/fontforge/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/tools/misc/fontforge/default.nix b/pkgs/tools/misc/fontforge/default.nix index c04b9255afcb..54551b5af39e 100644 --- a/pkgs/tools/misc/fontforge/default.nix +++ b/pkgs/tools/misc/fontforge/default.nix @@ -29,9 +29,8 @@ stdenv.mkDerivation rec { buildInputs = [ git autoconf automake gnum4 libtool perl pkgconfig gettext uthash python freetype zlib glib libungif libpng libjpeg libtiff libxml2 - pango ] - ++ lib.optionals withGTK [ gtk2 ] + ++ lib.optionals withGTK [ gtk2 pango ] ++ lib.optionals (withGTK && stdenv.isDarwin) [ Carbon Cocoa ]; configureFlags = From 4f73633f26e80fb8b06f68793973c6e5089c790c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 29 Aug 2016 22:28:50 +0200 Subject: [PATCH 3/4] treewide: stop using fontbhttf --- nixos/modules/config/fonts/fonts.nix | 2 +- pkgs/development/libraries/fontconfig/default.nix | 8 ++++---- .../development/libraries/fontconfig/make-fonts-cache.nix | 2 +- pkgs/development/libraries/fontconfig/make-fonts-conf.nix | 6 +++--- pkgs/servers/x11/xquartz/default.nix | 1 - pkgs/top-level/all-packages.nix | 6 +++--- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix index ea0a67038572..f913b8c33e56 100644 --- a/nixos/modules/config/fonts/fonts.nix +++ b/nixos/modules/config/fonts/fonts.nix @@ -22,7 +22,7 @@ with lib; config = { fonts.fonts = - [ pkgs.xorg.fontbhttf + [ pkgs.xorg.fontbhlucidatypewriter100dpi pkgs.xorg.fontbhlucidatypewriter75dpi pkgs.dejavu_fonts diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix index 74048afe731e..cf003344e528 100644 --- a/pkgs/development/libraries/fontconfig/default.nix +++ b/pkgs/development/libraries/fontconfig/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, fontbhttf +{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, dejavu_fonts , substituteAll }: /** Font configuration scheme @@ -44,8 +44,8 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-cache-dir=/var/cache/fontconfig" # otherwise the fallback is in $out/ "--disable-docs" - # just ~1MB; this is what you get when loading config fails for some reason - "--with-default-fonts=${fontbhttf}" + # just <1MB; this is what you get when loading config fails for some reason + "--with-default-fonts=${dejavu_fonts.minimal}" ]; # We should find a better way to access the arch reliably. @@ -66,7 +66,7 @@ stdenv.mkDerivation rec { postInstall = '' cd "$out/etc/fonts" - "${libxslt.bin}/bin/xsltproc" --stringparam fontDirectories "${fontbhttf}" \ + "${libxslt.bin}/bin/xsltproc" --stringparam fontDirectories "${dejavu_fonts.minimal}" \ --stringparam fontconfigConfigVersion "${configVersion}" \ --path $out/share/xml/fontconfig \ ${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \ diff --git a/pkgs/development/libraries/fontconfig/make-fonts-cache.nix b/pkgs/development/libraries/fontconfig/make-fonts-cache.nix index b996cd228c77..53c2a335cc0b 100644 --- a/pkgs/development/libraries/fontconfig/make-fonts-cache.nix +++ b/pkgs/development/libraries/fontconfig/make-fonts-cache.nix @@ -1,4 +1,4 @@ -{ runCommand, lib, writeText, fontconfig, fontbhttf, fontDirectories }: +{ runCommand, lib, writeText, fontconfig, fontDirectories }: runCommand "fc-cache" rec { diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix index 2d0a21ea9ddf..3cd4a894b37f 100644 --- a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix +++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix @@ -1,10 +1,10 @@ -{ runCommand, libxslt, fontconfig, fontbhttf, fontDirectories }: +{ runCommand, libxslt, fontconfig, dejavu_fonts, fontDirectories }: runCommand "fonts.conf" { buildInputs = [ libxslt fontconfig ]; - # Add a default font for non-nixos systems. fontbhttf is only about 1mb. - fontDirectories = fontDirectories ++ [ fontbhttf ]; + # Add a default font for non-nixos systems, <1MB and in nixos defaults. + fontDirectories = fontDirectories ++ [ dejavu_fonts.minimal ]; } '' xsltproc --stringparam fontDirectories "$fontDirectories" \ diff --git a/pkgs/servers/x11/xquartz/default.nix b/pkgs/servers/x11/xquartz/default.nix index 79b99faea9b9..9b7844960a23 100644 --- a/pkgs/servers/x11/xquartz/default.nix +++ b/pkgs/servers/x11/xquartz/default.nix @@ -60,7 +60,6 @@ let sudo launchctl load -w /Library/LaunchDaemons/$daemonName ''; fontDirs = [ - xorg.fontbhttf xorg.fontbhlucidatypewriter100dpi xorg.fontbhlucidatypewriter75dpi ttf_bitstream_vera diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 302069fd5214..ca4ab18864e5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6537,7 +6537,7 @@ in licenseAccepted = (config.neoload.accept_license or false); fontsConf = makeFontsConf { fontDirectories = [ - xorg.fontbhttf + dejavu_fonts.minimal ]; }; }; @@ -13726,7 +13726,7 @@ in bluez5 = bluez5_28; fontsConf = makeFontsConf { fontDirectories = [ - freefont_ttf xorg.fontmiscmisc xorg.fontbhttf + freefont_ttf xorg.fontmiscmisc ]; }; clucene_core = clucene_core_2; @@ -13745,7 +13745,7 @@ in bluez5 = bluez5_28; fontsConf = makeFontsConf { fontDirectories = [ - freefont_ttf xorg.fontmiscmisc xorg.fontbhttf + freefont_ttf xorg.fontmiscmisc ]; }; mdds = mdds_0_12_1; From 40dc278ee0d6f5e6d3928a78569a98355c079ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 29 Aug 2016 22:32:58 +0200 Subject: [PATCH 4/4] xorg.fontbhttf: mark as unfree https://bugzilla.redhat.com/show_bug.cgi?id=317641 --- pkgs/servers/x11/xorg/overrides.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index acbfe69ee43b..cdf8d6b43002 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -28,6 +28,10 @@ in buildInputs = attrs.buildInputs ++ [ xorg.mkfontscale ]; }; + fontbhttf = attrs: attrs // { + meta = attrs.meta // { license = lib.licenses.unfreeRedistributable; }; + }; + fontcursormisc = attrs: attrs // { buildInputs = attrs.buildInputs ++ [ xorg.mkfontscale ]; };