about summary refs log tree commit diff
path: root/pkgs/tools/typesetting/tex/texlive/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/typesetting/tex/texlive/default.nix')
-rw-r--r--pkgs/tools/typesetting/tex/texlive/default.nix23
1 files changed, 20 insertions, 3 deletions
diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix
index 60e7043e332d3..8b8dec2d001ab 100644
--- a/pkgs/tools/typesetting/tex/texlive/default.nix
+++ b/pkgs/tools/typesetting/tex/texlive/default.nix
@@ -24,7 +24,7 @@ let
 
   # function for creating a working environment from a set of TL packages
   combine = import ./combine.nix {
-    inherit bin buildEnv lib makeWrapper writeText runCommand
+    inherit bin buildEnv lib makeWrapper writeText runCommand toTLPkgList
       perl libfaketime makeFontsConf bash tl coreutils gawk gnugrep gnused;
     ghostscript = ghostscript_headless;
   };
@@ -101,12 +101,29 @@ let
       // lib.optionalAttrs (args ? deps) { deps = map (n: tl.${n}) (args.deps or [ ]); })
   ) overriddenTlpdb;
 
+  ### texlive.combine compatibility layer:
+  # convert TeX packages to { pkgs = [ ... ]; } lists
+  # respecting specified outputs
+  toTLPkgList = drv: if drv.outputSpecified or false
+    then let tlType = drv.tlType or tlOutToType.${drv.tlOutputName or drv.outputName} or null; in
+      lib.optional (tlType != null) (drv // { inherit tlType; })
+    else [ (drv.tex // { tlType = "run"; }) ] ++
+      lib.optional (drv ? texdoc) (drv.texdoc // { tlType = "doc"; } // lib.optionalAttrs (drv ? man) { hasManpages = true; }) ++
+      lib.optional (drv ? texsource) (drv.texsource // { tlType = "source"; }) ++
+      lib.optional (drv ? tlpkg) (drv.tlpkg // { tlType = "tlpkg"; }) ++
+      lib.optional (drv ? out) (drv.out // { tlType = "bin"; });
+  tlOutToType = { out = "bin"; tex = "run"; texsource = "source"; texdoc = "doc"; tlpkg = "tlpkg"; };
+
+  # export TeX packages as { pkgs = [ ... ]; } in the top attribute set
+  allPkgLists = lib.mapAttrs (n: drv: { pkgs = toTLPkgList drv; }) tl;
+
   assertions = with lib;
     assertMsg (tlpdbVersion.year == version.texliveYear) "TeX Live year in texlive does not match tlpdb.nix, refusing to evaluate" &&
     assertMsg (tlpdbVersion.frozen == version.final) "TeX Live final status in texlive does not match tlpdb.nix, refusing to evaluate";
 
 in
-  tl // {
+  allPkgLists // {
+    pkgs = tl;
 
     tlpdb = {
       # nested in an attribute set to prevent them from appearing in search
@@ -116,7 +133,7 @@ in
 
     bin = assert assertions; bin // {
       # for backward compatibility
-      latexindent = lib.findFirst (p: p.tlType == "bin") tl.latexindent.pkgs;
+      latexindent = tl.latexindent;
     };
 
     combine = assert assertions; combine;