diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index 7516d7ddf1a6..2d7549aab6d7 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -27,9 +27,11 @@ with lib;
config = mkIf config.fonts.enableFontConfig {
- # Bring in the default (upstream) fontconfig configuration.
+ # Fontconfig 2.10 backward compatibility
+
+ # Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
environment.etc."fonts/fonts.conf".source =
- pkgs.makeFontsConf { fontDirectories = config.fonts.fonts; };
+ pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
environment.etc."fonts/conf.d/00-nixos.conf".text =
''
@@ -47,6 +49,27 @@ with lib;
'';
+ # Versioned fontconfig > 2.10. Only specify font directories.
+
+ environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text =
+ ''
+
+
+
+
+
+
+
+ hintslight
+
+
+
+
+ ${concatStringsSep "\n" (map (font: "${font}") config.fonts.fonts)}
+
+
+ '';
+
environment.systemPackages = [ pkgs.fontconfig ];
};
diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix
index f6060a910a15..baf5b7713f5f 100644
--- a/nixos/modules/config/fonts/fonts.nix
+++ b/nixos/modules/config/fonts/fonts.nix
@@ -13,14 +13,6 @@ with lib;
type = types.listOf types.path;
example = literalExample "[ pkgs.dejavu_fonts ]";
description = "List of primary font paths.";
- apply = list: list ++
- [ # - the user's current profile
- "~/.nix-profile/lib/X11/fonts"
- "~/.nix-profile/share/fonts"
- # - the default profile
- "/nix/var/nix/profiles/default/lib/X11/fonts"
- "/nix/var/nix/profiles/default/share/fonts"
- ];
};
};
diff --git a/pkgs/development/libraries/fontconfig/2.10.nix b/pkgs/development/libraries/fontconfig/2.10.nix
new file mode 100644
index 000000000000..2951dbb44d4f
--- /dev/null
+++ b/pkgs/development/libraries/fontconfig/2.10.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, pkgconfig, freetype, expat }:
+
+stdenv.mkDerivation rec {
+ name = "fontconfig-2.10.2";
+
+ src = fetchurl {
+ url = "http://fontconfig.org/release/${name}.tar.bz2";
+ sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
+ };
+
+ infinality_patch =
+ let subvers = "1";
+ in fetchurl {
+ url = http://www.infinality.net/fedora/linux/zips/fontconfig-infinality-1-20130104_1.tar.bz2;
+ sha256 = "1fm5xx0mx2243jrq5rxk4v0ajw2nawpj23399h710bx6hd1rviq7";
+ }
+ ;
+
+ propagatedBuildInputs = [ freetype ];
+ buildInputs = [ pkgconfig expat ];
+
+ configureFlags = [
+ "--sysconfdir=/etc"
+ "--with-cache-dir=/var/cache/fontconfig"
+ "--disable-docs"
+ "--with-default-fonts="
+ ];
+
+ # We should find a better way to access the arch reliably.
+ crossArch = stdenv.cross.arch or null;
+
+ preConfigure = ''
+ if test -n "$crossConfig"; then
+ configureFlags="$configureFlags --with-arch=$crossArch";
+ fi
+ '';
+
+ enableParallelBuilding = true;
+
+ doCheck = true;
+
+ # Don't try to write to /var/cache/fontconfig at install time.
+ installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
+
+ postInstall = ''
+ cd "$out/etc/fonts" && tar xvf ${infinality_patch}
+ '';
+
+ passthru = {
+ # Empty for backward compatibility, there was no versioning before 2.11
+ configVersion = "";
+ };
+
+ meta = with stdenv.lib; {
+ description = "A library for font customization and configuration";
+ homepage = http://fontconfig.org/;
+ license = licenses.bsd2; # custom but very bsd-like
+ platforms = platforms.all;
+ maintainers = [ maintainers.vcunat ];
+ };
+}
diff --git a/pkgs/development/libraries/fontconfig/builder.sh b/pkgs/development/libraries/fontconfig/builder.sh
deleted file mode 100644
index d755bca64e32..000000000000
--- a/pkgs/development/libraries/fontconfig/builder.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-source $stdenv/setup
-
-configureFlags="--with-confdir=$out/etc/fonts --disable-docs"
-
-genericBuild
diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix
index f0c4da755673..1fc7c490d55b 100644
--- a/pkgs/development/libraries/fontconfig/default.nix
+++ b/pkgs/development/libraries/fontconfig/default.nix
@@ -1,11 +1,14 @@
-{ stdenv, fetchurl, pkgconfig, freetype, expat }:
+{ stdenv, fetchurl, pkgconfig, freetype, expat, libxslt, fontbhttf }:
+let
+ configVersion = "2.11"; # bump whenever fontconfig breaks compatibility with older configurations
+in
stdenv.mkDerivation rec {
- name = "fontconfig-2.10.2";
+ name = "fontconfig-2.11.1";
src = fetchurl {
url = "http://fontconfig.org/release/${name}.tar.bz2";
- sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
+ sha256 = "16baa4g5lswkyjlyf1h5lwc0zjap7c4d8grw79349a5w6dsl8qnw";
};
infinality_patch =
@@ -17,13 +20,12 @@ stdenv.mkDerivation rec {
;
propagatedBuildInputs = [ freetype ];
- buildInputs = [ pkgconfig expat ];
+ buildInputs = [ pkgconfig libxslt expat ];
configureFlags = [
- "--sysconfdir=/etc"
"--with-cache-dir=/var/cache/fontconfig"
"--disable-docs"
- "--with-default-fonts="
+ "--with-default-fonts=${fontbhttf}"
];
# We should find a better way to access the arch reliably.
@@ -40,12 +42,24 @@ stdenv.mkDerivation rec {
doCheck = true;
# Don't try to write to /var/cache/fontconfig at install time.
- installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
+ installFlags = "fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
+ # Add a default font for non-nixos systems. fontbhttf is only about 1mb.
postInstall = ''
cd "$out/etc/fonts" && tar xvf ${infinality_patch}
+ xsltproc --stringparam fontDirectories "${fontbhttf}" \
+ --stringparam fontconfig "$out" \
+ --stringparam fontconfigConfigVersion "${configVersion}" \
+ --path $out/share/xml/fontconfig \
+ ${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \
+ > fonts.conf.tmp
+ mv fonts.conf.tmp $out/etc/fonts/fonts.conf
'';
+ passthru = {
+ inherit configVersion;
+ };
+
meta = with stdenv.lib; {
description = "A library for font customization and configuration";
homepage = http://fontconfig.org/;
diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
index f9cd096f559b..2b02e0df7a04 100644
--- a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
+++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
@@ -1,13 +1,15 @@
-{ runCommand, libxslt, fontconfig, fontDirectories }:
+{ runCommand, libxslt, fontconfig, fontbhttf, fontDirectories }:
runCommand "fonts.conf"
{
buildInputs = [ libxslt fontconfig ];
- inherit fontDirectories;
+ # Add a default font for non-nixos systems. fontbhttf is only about 1mb.
+ fontDirectories = fontDirectories ++ [ fontbhttf ];
}
''
xsltproc --stringparam fontDirectories "$fontDirectories" \
--stringparam fontconfig "${fontconfig}" \
+ --stringparam fontconfigConfigVersion "${fontconfig.configVersion}" \
--path ${fontconfig}/share/xml/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
index e3938663c9b4..03f7815e38ad 100644
--- a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
+++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
@@ -16,25 +16,37 @@
+
- /etc/fonts/conf.d
+
/etc/fonts/conf.d
+
+ /etc/fonts//conf.d
+
+ fontconfig/conf.d
+
+ fontconfig
+
/var/cache/fontconfig
- ~/.fontconfig
+ fonts
- fonts
-
- ~/.fonts
+
+
+ ~/.nix-profile/lib/X11/fonts
+ ~/.nix-profile/share/fonts
+
+ /nix/var/nix/profiles/default/lib/X11/fonts
+ /nix/var/nix/profiles/default/share/fonts
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e06de1c25637..21c401c746a4 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4944,11 +4944,14 @@ let
cfitsio = callPackage ../development/libraries/cfitsio { };
+ fontconfig_210 = callPackage ../development/libraries/fontconfig/2.10.nix { };
+
fontconfig = callPackage ../development/libraries/fontconfig { };
makeFontsConf = let fontconfig_ = fontconfig; in {fontconfig ? fontconfig_, fontDirectories}:
import ../development/libraries/fontconfig/make-fonts-conf.nix {
inherit runCommand libxslt fontconfig fontDirectories;
+ inherit (xorg) fontbhttf;
};
freealut = callPackage ../development/libraries/freealut { };