diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix new file mode 100644 index 000000000000..bf94bfa34d2b --- /dev/null +++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix @@ -0,0 +1,13 @@ +{runCommand, libxslt, fontconfig, fontDirectories}: + +runCommand "fonts.conf" + { + buildInputs = [libxslt]; + inherit fontDirectories; + } + '' + xsltproc --stringparam fontDirectories "$fontDirectories" \ + --stringparam fontconfig "${fontconfig}" \ + ${./make-fonts-conf.xsl} ${fontconfig}/etc/fonts/fonts.conf \ + > $out + '' diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl new file mode 100644 index 000000000000..f716700d98e3 --- /dev/null +++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + /etc/fonts/conf.d + /etc/fonts/conf.d + + /var/cache/fontconfig + ~/.fontconfig + + + + + + + + + + + diff --git a/pkgs/misc/tex/nix/default.nix b/pkgs/misc/tex/nix/default.nix index cb416132cf92..5252e7a11eba 100644 --- a/pkgs/misc/tex/nix/default.nix +++ b/pkgs/misc/tex/nix/default.nix @@ -58,9 +58,9 @@ rec { pkgs.stdenv.mkDerivation { name = "pdf"; builder = ./dot2pdf.sh; - inherit dotGraph; + inherit dotGraph fontsConf; buildInputs = [ - pkgs.perl pkgs.tetex pkgs.graphviz pkgs.ghostscript + pkgs.perl pkgs.tetex pkgs.graphviz ]; }; @@ -180,4 +180,13 @@ rec { }; + # Some tools (like dot) need a fontconfig configuration file. + # This should be extended to allow the called to add additional + # fonts. + fontsConf = pkgs.makeFontsConf { + fontDirectories = [ + "${pkgs.ghostscript}/share/ghostscript/fonts" + ]; + }; + } diff --git a/pkgs/misc/tex/nix/dot2pdf.sh b/pkgs/misc/tex/nix/dot2pdf.sh index 65799a421347..0a9610c00ff2 100644 --- a/pkgs/misc/tex/nix/dot2pdf.sh +++ b/pkgs/misc/tex/nix/dot2pdf.sh @@ -6,8 +6,8 @@ dot2pdf() { sourceFile=$1 targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf echo "converting $sourceFile to $targetName..." - dot -Tps $sourceFile > tmp.ps - perl $(type -tp epstopdf) --outfile $targetName tmp.ps + export FONTCONFIG_FILE=$fontsConf + dot -Tpdf $sourceFile > $targetName } for i in $dotGraph; do diff --git a/pkgs/tools/graphics/graphviz/default.nix b/pkgs/tools/graphics/graphviz/default.nix index abde6da66d6e..93a98891d135 100644 --- a/pkgs/tools/graphics/graphviz/default.nix +++ b/pkgs/tools/graphics/graphviz/default.nix @@ -1,16 +1,19 @@ -{stdenv, fetchurl, x11, libpng, libjpeg, expat, libXaw, yacc, libtool}: +{ stdenv, fetchurl, pkgconfig, x11, libpng, libjpeg, expat, libXaw +, yacc, libtool, fontconfig, pango, gd +}: assert libpng != null && libjpeg != null && expat != null; stdenv.mkDerivation { - name = "graphviz-2.16.1"; + name = "graphviz-2.20.2"; src = fetchurl { - url = http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.16.1.tar.gz; - sha256 = "1lan1hyar0xbqvnkcmlcvv02g8zfpk94gk04y4sik5irpa2s3h9j"; + url = http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.20.2.tar.gz; + sha256 = "13mw0mhr4n14c5q7a6c44cvggl5hiqbx53ynr53s67rldvzcilgm"; }; - buildInputs = [x11 libpng libjpeg expat libXaw yacc libtool]; + buildInputs = [pkgconfig x11 libpng libjpeg expat libXaw yacc libtool fontconfig pango gd]; + configureFlags = [ "--with-pngincludedir=${libpng}/include" "--with-pnglibdir=${libpng}/lib" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6337c7c988ab..f195f6dd082d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -678,8 +678,10 @@ let pkgs = rec { }; graphviz = import ../tools/graphics/graphviz { - inherit fetchurl stdenv libpng libjpeg expat x11 yacc libtool; + inherit fetchurl stdenv pkgconfig libpng libjpeg expat x11 yacc + libtool fontconfig gd; inherit (xlibs) libXaw; + inherit (gtkLibs) pango; }; groff = import ../tools/text/groff { @@ -2520,6 +2522,11 @@ let pkgs = rec { inherit fetchurl stdenv freetype expat; }; + makeFontsConf = let fontconfig_ = fontconfig; in {fontconfig ? fontconfig_, fontDirectories}: + import ../development/libraries/fontconfig/make-fonts-conf.nix { + inherit runCommand libxslt fontconfig fontDirectories; + }; + freealut = import ../development/libraries/freealut { inherit fetchurl stdenv openal; }; @@ -7155,7 +7162,7 @@ let pkgs = rec { */ texFunctions = import ../misc/tex/nix { - inherit stdenv perl tetex graphviz ghostscript; + inherit stdenv perl tetex graphviz ghostscript makeFontsConf; }; texLiveFun = builderDefsPackage (import ../misc/tex/texlive) {