summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorImmae <immae@users.noreply.github.com>2019-12-21 17:37:54 +0100
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2019-12-21 11:37:54 -0500
commitb42bede861206e10e2c6670f4a0a504c531b6571 (patch)
treea150bedae4b5a07690e5ba5c4222080abed3d882 /doc
parent013e439fd8768b5104d9c6e3b7205be3001a124a (diff)
downloadnixpkgs-b42bede861206e10e2c6670f4a0a504c531b6571.tar
nixpkgs-b42bede861206e10e2c6670f4a0a504c531b6571.tar.gz
nixpkgs-b42bede861206e10e2c6670f4a0a504c531b6571.tar.bz2
nixpkgs-b42bede861206e10e2c6670f4a0a504c531b6571.tar.lz
nixpkgs-b42bede861206e10e2c6670f4a0a504c531b6571.tar.xz
nixpkgs-b42bede861206e10e2c6670f4a0a504c531b6571.tar.zst
nixpkgs-b42bede861206e10e2c6670f4a0a504c531b6571.zip
doc/texlive: Add "Custom packages" section (#74519)
Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/languages-frameworks/texlive.xml91
1 files changed, 91 insertions, 0 deletions
diff --git a/doc/languages-frameworks/texlive.xml b/doc/languages-frameworks/texlive.xml
index 7876cc213b6..8fa8f963b2f 100644
--- a/doc/languages-frameworks/texlive.xml
+++ b/doc/languages-frameworks/texlive.xml
@@ -59,6 +59,97 @@ nix-repl> texlive.collection-<TAB>
   </itemizedlist>
  </section>
 
+ <section xml:id="sec-language-texlive-custom-packages">
+  <title>Custom packages</title>
+  <para>
+    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 <varname>tlType</varname> attribute. Here is a (very verbose) example:
+<programlisting><![CDATA[
+with import <nixpkgs> {};
+
+let
+  foiltex_run = stdenvNoCC.mkDerivation {
+    pname = "latex-foiltex";
+    version = "2.1.4b";
+    passthru.tlType = "run";
+
+    srcs = [
+      (fetchurl {
+        url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.dtx";
+        sha256 = "07frz0krpz7kkcwlayrwrj2a2pixmv0icbngyw92srp9fp23cqpz";
+      })
+      (fetchurl {
+        url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.ins";
+        sha256 = "09wkyidxk3n3zvqxfs61wlypmbhi1pxmjdi1kns9n2ky8ykbff99";
+      })
+    ];
+
+    unpackPhase = ''
+      runHook preUnpack
+
+      for _src in $srcs; do
+        cp "$_src" $(stripHash "$_src")
+      done
+
+      runHook postUnpack
+    '';
+
+    nativeBuildInputs = [ texlive.combined.scheme-small ];
+
+    dontConfigure = true;
+
+    buildPhase = ''
+      runHook preBuild
+
+      # Generate the style files
+      latex foiltex.ins
+
+      runHook postBuild
+    '';
+
+    installPhase = ''
+      runHook preInstall
+
+      path="$out/tex/latex/foiltex"
+      mkdir -p "$path"
+      cp *.{cls,def,clo} "$path/"
+
+      runHook postInstall
+    '';
+
+    meta = with lib; {
+      description = "A LaTeX2e class for overhead transparencies";
+      license = licenses.unfreeRedistributable;
+      maintainers = with maintainers; [ veprbl ];
+      platforms = platforms.all;
+    };
+  };
+  foiltex = { pkgs = [ foiltex_run ]; };
+
+  latex_with_foiltex = texlive.combine {
+    inherit (texlive) scheme-small;
+    inherit foiltex;
+  };
+in
+  runCommand "test.pdf" {
+    nativeBuildInputs = [ latex_with_foiltex ];
+  } ''
+cat >test.tex <<EOF
+\documentclass{foils}
+
+\title{Presentation title}
+\date{}
+
+\begin{document}
+\maketitle
+\end{document}
+EOF
+  pdflatex test.tex
+  cp test.pdf $out
+''
+]]></programlisting>
+  </para>
+ </section>
+
  <section xml:id="sec-language-texlive-known-problems">
   <title>Known problems</title>