diff --git a/pkgs/test/texlive/default.nix b/pkgs/test/texlive/default.nix index cbfa0c45e8fc..91a894906cc7 100644 --- a/pkgs/test/texlive/default.nix +++ b/pkgs/test/texlive/default.nix @@ -11,11 +11,11 @@ diff -u "''${nixpkgsTlpdbNix}" "''${tlpdbNix}" | tee "$out/tlpdb.nix.patch" ''; - luaotfload-fonts = runCommand "texlive-test-lualatex" { + opentype-fonts = runCommand "texlive-test-opentype" { nativeBuildInputs = [ (with texlive; combine { inherit scheme-medium libertinus-fonts; }) ]; - input = builtins.toFile "lualatex-testfile.tex" '' + input = builtins.toFile "opentype-testfile.tex" '' \documentclass{article} \usepackage{fontspec} \setmainfont{Libertinus Serif} @@ -26,7 +26,13 @@ } '' export HOME="$(mktemp -d)" + # We use the same testfile to test two completely different + # font discovery mechanisms, both of which were once broken: + # - lualatex uses its own luaotfload script (#220228) + # - xelatex uses fontconfig (#228196) + # both of the following two commands need to succeed. lualatex -halt-on-error "$input" + xelatex -halt-on-error "$input" echo success > $out ''; diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix index 9ccd2cfe7614..7868842cbee5 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/combine.nix @@ -82,8 +82,12 @@ in (buildEnv { nativeBuildInputs = [ makeWrapper libfaketime perl bin.texlinks ]; buildInputs = pkgList.extraInputs; - # This is set primarily to help find-tarballs.nix to do its job - passthru.packages = pkgList.all; + passthru = { + # This is set primarily to help find-tarballs.nix to do its job + packages = pkgList.all; + # useful for inclusion in the `fonts.fonts` nixos option or for use in devshells + fonts = "${texmfroot}/texmf-dist/fonts"; + }; postBuild = '' TEXMFROOT="${texmfroot}" @@ -196,7 +200,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 +319,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; };