Unverified Commit df3bf8ff authored by Dmitry Kalinkin's avatar Dmitry Kalinkin Committed by GitHub
Browse files

Merge pull request #218331 from xworld21/texlive-new-dependency-resolution

texlive.combine: move dependencies to attribute tlDeps, resolve them …
parents 83ca2cd7 35b698d0
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -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 <nixpkgs> {};

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;
+8 −7
Original line number Diff line number Diff line
@@ -23,14 +23,13 @@
, poppler
, auto-multiple-choice
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
  pname = "auto-multiple-choice";
  version = "1.5.2";
  src = fetchurl {
    url = "https://download.auto-multiple-choice.net/${pname}_${version}_precomp.tar.gz";
    sha256 = "sha256-AjonJOooSe53Fww3QU6Dft95ojNqWrTuPul3nkIbctM=";
  };
  tlType = "run";

  # There's only the Makefile
  dontConfigure = true;
@@ -137,6 +136,11 @@ stdenv.mkDerivation rec {
    XMLWriter
  ]);

  passthru = {
    tlType = "run";
    pkgs = [ finalAttrs.finalPackage ];
  };

  meta = with lib; {
    description = "Create and manage multiple choice questionnaires with automated marking.";
    longDescription = ''
@@ -156,10 +160,7 @@ stdenv.mkDerivation rec {
        auto-multiple-choice
        (texlive.combine {
          inherit (pkgs.texlive) scheme-full;
          extra =
            {
              pkgs = [ auto-multiple-choice ];
            };
          inherit auto-multiple-choice;
        })
      ];
      </screen>
@@ -172,4 +173,4 @@ stdenv.mkDerivation rec {
    maintainers = [ maintainers.thblt ];
    platforms = platforms.all;
  };
}
})
+6 −4
Original line number Diff line number Diff line
{ lib, stdenv, fetchurl, bison, flex, makeWrapper, texinfo4, getopt, readline, texlive }:

lib.fix (eukleides: stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
  pname = "eukleides";
  version = "1.5.4";

@@ -49,10 +49,12 @@ lib.fix (eukleides: stdenv.mkDerivation rec {

  outputs = [ "out" "doc" "tex" ];

  passthru.tlType = "run";
  passthru.pkgs = [ eukleides.tex ]
  passthru = {
    tlType = "run";
    # packages needed by euktoeps, euktopdf and eukleides.sty
    ++ (with texlive; collection-pstricks.pkgs ++ epstopdf.pkgs ++ iftex.pkgs ++ moreverb.pkgs);
    tlDeps = with texlive; [ collection-pstricks epstopdf iftex moreverb ];
    pkgs = [ finalAttrs.finalPackage.tex ];
  };

  meta = {
    description = "Geometry Drawing Language";
+5 −3
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub, nawk, groff, icon-lang, useIcon ? true }:

lib.fix (noweb: stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
  pname = "noweb";
  version = "2.12";

@@ -70,8 +70,10 @@ lib.fix (noweb: stdenv.mkDerivation rec {

  outputs = [ "out" "tex" ];

  passthru = {
    tlType = "run";
  passthru.pkgs = [ noweb.tex ];
    pkgs = [ finalAttrs.finalPackage.tex ];
  };

  meta = with lib; {
    description = "A simple, extensible literate-programming tool";
+7 −3
Original line number Diff line number Diff line
@@ -4,10 +4,9 @@
, texlive
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
  pname = "sagetex";
  version = "3.6.1";
  passthru.tlType = "run";

  src = fetchFromGitHub {
    owner = "sagemath";
@@ -30,6 +29,11 @@ stdenv.mkDerivation rec {
    cp -va *.sty *.cfg *.def "$path/"
  '';

  passthru = {
    tlType = "run";
    pkgs = [ finalAttrs.finalPackage ];
  };

  meta = with lib; {
    description = "Embed code, results of computations, and plots from Sage into LaTeX documents";
    homepage = "https://github.com/sagemath/sagetex";
@@ -37,4 +41,4 @@ stdenv.mkDerivation rec {
    maintainers = with maintainers; [ alexnortung ];
    platforms = platforms.all;
  };
}
})
Loading