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

Merge pull request #250805 from xworld21/texlive-buildenv-minimal

texlive: overrideTeXConfig/withPackages
parents f77fc56a 7620b617
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -38,6 +38,24 @@ Since release 15.09 there is a new TeX Live packaging that lives entirely under

- Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example `scheme-basic`, into the combination.

- TeX Live packages are also available under `texlive.pkgs` as derivations with outputs `out`, `tex`, `texdoc`, `texsource`, `tlpkg`, `man`, `info`. They cannot be installed outside of `texlive.combine` but are available for other uses. To repackage a font, for instance, use

  ```nix
  stdenvNoCC.mkDerivation rec {
    src = texlive.pkgs.iwona;

    inherit (src) pname version;

    installPhase = ''
      runHook preInstall
      install -Dm644 fonts/opentype/nowacki/iwona/*.otf -t $out/share/fonts/opentype
      runHook postInstall
    '';
  }
  ```

  See `biber`, `iwona` for complete examples.

## 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`.
+4 −5
Original line number Diff line number Diff line
{ lib, stdenvNoCC, texlive }:

stdenvNoCC.mkDerivation {
  pname = "iwona";
  version = "0.995b";
stdenvNoCC.mkDerivation rec {
  inherit (src) pname version;

  src = lib.head (builtins.filter (p: p.tlType == "run") texlive.iwona.pkgs);
  src = texlive.pkgs.iwona;

  installPhase = ''
    runHook preInstall
@@ -20,7 +19,7 @@ stdenvNoCC.mkDerivation {
    # "[...] GUST Font License (GFL), which is a free license, legally
    # equivalent to the LaTeX Project Public # License (LPPL), version 1.3c or
    # later." - GUST website
    license = licenses.lppl13c;
    license = src.meta.license;
    maintainers = with maintainers; [ siddharthist ];
    platforms = platforms.all;
  };
+10 −8
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, writeShellScript
, texlive
}:

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

@@ -15,8 +16,14 @@ stdenv.mkDerivation (finalAttrs: rec {
    sha256 = "sha256-OfhbXHbGI+DaDHqZCOGiSHJPHjGuT7ZqSEjKweloW38=";
  };

  buildInputs = [
  outputs = [ "tex" ];

  nativeBuildInputs = [
    texlive.combined.scheme-basic
    # multiple-outputs.sh fails if $out is not defined
    (writeShellScript "force-tex-output.sh" ''
      out="''${tex-}"
    '')
  ];

  buildPhase = ''
@@ -29,11 +36,6 @@ stdenv.mkDerivation (finalAttrs: 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";
@@ -41,4 +43,4 @@ stdenv.mkDerivation (finalAttrs: rec {
    maintainers = with maintainers; [ alexnortung ];
    platforms = platforms.all;
  };
})
}
+10 −9
Original line number Diff line number Diff line
@@ -454,8 +454,7 @@ rec {
      '';

      # link all binaries in single derivation
      allPackages = with lib; concatLists (catAttrs "pkgs" (filter isAttrs (attrValues texlive)));
      binPackages = lib.filter (p: p.tlType == "bin") allPackages;
      binPackages = lib.catAttrs "out" (lib.attrValues texlive.pkgs);
      binaries = buildEnv { name = "texlive-binaries"; paths = binPackages; };
    in
    runCommand "texlive-test-binaries"
@@ -565,8 +564,7 @@ rec {

  # check that all scripts have a Nix shebang
  shebangs = let
      allPackages = with lib; concatLists (catAttrs "pkgs" (filter isAttrs (attrValues texlive)));
      binPackages = lib.filter (p: p.tlType == "bin") allPackages;
      binPackages = lib.catAttrs "out" (lib.attrValues texlive.pkgs);
    in
    runCommand "texlive-test-shebangs" { }
      (''
@@ -615,7 +613,7 @@ rec {
        correctLicenses = scheme: builtins.foldl'
                (acc: pkg: concatLicenses acc (lib.toList (pkg.meta.license or [])))
                []
                scheme.passthru.packages;
                scheme.passthru.requiredTeXPackages;
        correctLicensesAttrNames = scheme:
          lib.sort lt
            (map licenseToAttrName (correctLicenses scheme));
@@ -648,10 +646,13 @@ rec {
  # this is effectively an eval-time assertion, converted into a derivation for
  # ease of testing
  fixedHashes = with lib; let
    combine = findFirst (p: (head p.pkgs).pname == "combine") { pkgs = []; } (head texlive.collection-latexextra.pkgs).tlDeps;
    all = concatLists (map (p: p.pkgs or []) (attrValues (removeAttrs texlive [ "bin" "combine" "combined" "tlpdb" ]))) ++ combine.pkgs;
    fods = filter (p: isDerivation p && p.tlType != "bin") all;
    errorText = concatMapStrings (p: optionalString (! p ? outputHash) "${p.pname + optionalString (p.tlType != "run") ("." + p.tlType)} does not have a fixed output hash\n") fods;
    fods = lib.concatMap
      (p: lib.optional (p ? tex) p.tex
        ++ lib.optional (p ? texdoc) p.texdoc
        ++ lib.optional (p ? texsource) p.texsource
        ++ lib.optional (p ? tlpkg) p.tlpkg)
      (attrValues texlive.pkgs);
    errorText = concatMapStrings (p: optionalString (! p ? outputHash) "${p.pname}-${p.tlOutputName} does not have a fixed output hash\n") fods;
  in runCommand "texlive-test-fixed-hashes" {
    inherit errorText;
    passAsFile = [ "errorText" ];
+2 −3
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub, fetchurl, perlPackages, shortenPerlShebang, texlive }:

let
  biberSource = lib.head (builtins.filter (p: p.tlType == "source") texlive.biber-ms.pkgs);
  biberSource = texlive.pkgs.biber-ms.texsource;
  # missing test file
  multiscriptBltxml = (fetchFromGitHub {
    owner = "plk";
@@ -12,8 +12,7 @@ let
in

perlPackages.buildPerlModule {
  pname = "biber-ms";
  inherit (biberSource) version;
  inherit (biberSource) pname version;

  src = "${biberSource}/source/bibtex/biber-ms/biblatex-biber-ms.tar.gz";

Loading