From 5f96aa94364effe057e59dbf4a11050c3403b8e9 Mon Sep 17 00:00:00 2001 From: apfelkuchen06 Date: Tue, 25 Apr 2023 22:14:03 +0200 Subject: [PATCH] texlive.combine: wrap with FONTCONFIG_FILE This is neccessary for XeTeX to find the fonts distributed with TeXLive. The fontconfig file generated by makeFontsConf is almost identical to the one from the fontconfig package and /etc/fonts/fonts.conf on NixOS -- it only adds the specified font directories. In particular this means that all the actual configuration files in /etc/fonts/conf.d are still included and there also is a /usr/share/fonts font directory entry for use with non-NixOS linuxes, so it's unlikely that this breaks someone's setup. --- pkgs/tools/typesetting/tex/texlive/combine.nix | 8 +++++--- pkgs/tools/typesetting/tex/texlive/default.nix | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix index 80070cc6cfaa..22f644d9cb09 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/combine.nix @@ -196,7 +196,11 @@ in (buildEnv { makeWrapper "$target" "$link" \ --prefix PATH : "${gnused}/bin:${gnugrep}/bin:${coreutils}/bin:$out/bin:${perl}/bin" \ --prefix PERL5LIB : "$PERL5LIB" \ - --set-default TEXMFCNF "$TEXMFCNF" + --set-default TEXMFCNF "$TEXMFCNF" \ + --set-default FONTCONFIG_FILE "${ + # neccessary for XeTeX to find the fonts distributed with texlive + makeFontsConf { fontDirectories = [ "${texmfroot}/texmf-dist/fonts" ]; } + }" # avoid using non-nix shebang in $target by calling interpreter if [[ "$(head -c 2 "$target")" = "#!" ]]; then @@ -311,5 +315,3 @@ in (buildEnv { '' ; }).overrideAttrs (_: { allowSubstitutes = true; }) -# TODO: make TeX fonts visible by fontconfig: it should be enough to install an appropriate file -# similarly, deal with xe(la)tex font visibility? diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix index cbdedc9310c3..e46f6425b497 100644 --- a/pkgs/tools/typesetting/tex/texlive/default.nix +++ b/pkgs/tools/typesetting/tex/texlive/default.nix @@ -5,7 +5,7 @@ { stdenv, lib, fetchurl, runCommand, writeText, buildEnv , callPackage, ghostscript_headless, harfbuzz , makeWrapper, python3, ruby, perl, gnused, gnugrep, coreutils -, libfaketime +, libfaketime, makeFontsConf , useFixedHashes ? true , recurseIntoAttrs }: @@ -24,7 +24,7 @@ let # function for creating a working environment from a set of TL packages combine = import ./combine.nix { inherit bin combinePkgs buildEnv lib makeWrapper writeText - stdenv python3 ruby perl gnused gnugrep coreutils libfaketime; + stdenv python3 ruby perl gnused gnugrep coreutils libfaketime makeFontsConf; ghostscript = ghostscript_headless; };