From 57b2634ac1242bd8d34b6c78396b217c65418755 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Sat, 11 Mar 2023 20:57:23 +0000 Subject: [PATCH] texlive.combine: document how to create custom packages with pkgs and tlDeps attributes --- doc/languages-frameworks/texlive.section.md | 16 +++++++++++----- pkgs/tools/typesetting/tex/texlive/combine.nix | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/languages-frameworks/texlive.section.md b/doc/languages-frameworks/texlive.section.md index e790e217cac0..72ab14126bed 100644 --- a/doc/languages-frameworks/texlive.section.md +++ b/doc/languages-frameworks/texlive.section.md @@ -40,17 +40,24 @@ Since release 15.09 there is a new TeX Live packaging that lives entirely under ## Custom packages {#sec-language-texlive-custom-packages} +You may find that you need to use an external TeX package. A derivation for such package has to provide the contents of the "texmf" directory in its output and provide the appropriate `tlType` attribute (one of `"run"`, `"bin"`, `"doc"`, `"source"`). Dependencies on other TeX packages can be listed in the attribute `tlDeps`. -You may find that you need to use an external TeX package. A derivation for such package has to provide contents of the "texmf" directory in its output and provide the `tlType` attribute. Here is a (very verbose) example: +Such derivation must then be listed in the attribute `pkgs` of an attribute set passed to `texlive.combine`, for instance by passing `extraPkgs = { pkgs = [ custom_package ]; };`. Within Nixpkgs, `pkgs` should be part of the derivation itself, allowing users to call `texlive.combine { inherit (texlive) scheme-small; inherit some_tex_package; }`. + +Here is a (very verbose) example where the attribute `pkgs` is attached to the derivation itself, which requires creating a fixed point. See also the packages `auctex`, `eukleides`, `mftrace` for more examples. ```nix with import {}; let - foiltex_run = stdenvNoCC.mkDerivation { + foiltex = stdenvNoCC.mkDerivation (finalAttrs: { pname = "latex-foiltex"; version = "2.1.4b"; - passthru.tlType = "run"; + passthru = { + pkgs = [ finalAttrs.finalPackage ]; + tlDeps = with texlive; [ latex ]; + tlType = "run"; + }; srcs = [ (fetchurl { @@ -102,8 +109,7 @@ let maintainers = with maintainers; [ veprbl ]; platforms = platforms.all; }; - }; - foiltex = { pkgs = [ foiltex_run ]; }; + }); latex_with_foiltex = texlive.combine { inherit (texlive) scheme-small; diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix index 5ed6500654a5..1b67c62a7eeb 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/combine.nix @@ -121,9 +121,9 @@ in (buildEnv { # now filter hyphenation patterns and formats (let hyphens = lib.filter (p: p.hasHyphens or false && p.tlType == "run") pkgList.splitBin.wrong; - hyphenPNames = lib.sort (a: b: a < b) (map (p: p.pname) hyphens); + hyphenPNames = map (p: p.pname) hyphens; formats = lib.filter (p: p.hasFormats or false && p.tlType == "run") pkgList.splitBin.wrong; - formatPNames = lib.sort (a: b: a < b) (map (p: p.pname) formats); + formatPNames = map (p: p.pname) formats; # sed expression that prints the lines in /start/,/end/ except for /end/ section = start: end: "/${start}/,/${end}/{ /${start}/p; /${end}/!p; };\n"; script =