diff options
Diffstat (limited to 'pkgs/tools/typesetting/tex')
-rw-r--r-- | pkgs/tools/typesetting/tex/advi/default.nix | 4 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/auctex/default.nix | 4 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/blahtexml/default.nix | 9 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/catdvi/default.nix | 5 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/dblatex/default.nix | 16 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/mftrace/default.nix | 6 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/bin.nix | 15 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/build-tex-env.nix (renamed from pkgs/tools/typesetting/tex/texlive/combine.nix) | 230 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix | 267 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/combine-wrapper.nix | 42 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/default.nix | 171 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/generate-fixed-hashes.nix | 29 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/tl2nix.sed | 1 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/tlpdb-overrides.nix | 17 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/tlpdb.nix | 15 |
15 files changed, 570 insertions, 261 deletions
diff --git a/pkgs/tools/typesetting/tex/advi/default.nix b/pkgs/tools/typesetting/tex/advi/default.nix index 1b69270a3f4..3b6b2eb3048 100644 --- a/pkgs/tools/typesetting/tex/advi/default.nix +++ b/pkgs/tools/typesetting/tex/advi/default.nix @@ -4,7 +4,7 @@ , writeShellScriptBin , ghostscriptX , ocamlPackages -, texlive +, texliveMedium , which }: @@ -51,7 +51,7 @@ ocamlPackages.buildDunePackage rec { duneVersion = "3"; - nativeBuildInputs = [ fake-opam kpsexpand makeWrapper texlive.combined.scheme-medium which ]; + nativeBuildInputs = [ fake-opam kpsexpand makeWrapper texliveMedium which ]; buildInputs = with ocamlPackages; [ camlimages ghostscriptX graphics ]; # install additional files (such as man pages) diff --git a/pkgs/tools/typesetting/tex/auctex/default.nix b/pkgs/tools/typesetting/tex/auctex/default.nix index e928608f9e2..b0fcc3b4d47 100644 --- a/pkgs/tools/typesetting/tex/auctex/default.nix +++ b/pkgs/tools/typesetting/tex/auctex/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, emacs, texlive, ghostscript }: +{ lib, stdenv, fetchurl, emacs, texliveBasic, ghostscript }: let auctex = stdenv.mkDerivation ( rec { # Make this a valid tex(live-new) package; @@ -17,7 +17,7 @@ let auctex = stdenv.mkDerivation ( rec { buildInputs = [ emacs ghostscript - (texlive.combine { inherit (texlive) scheme-basic hypdoc; }) + (texliveBasic.withPackages (ps: [ ps.hypdoc ])) ]; preConfigure = '' diff --git a/pkgs/tools/typesetting/tex/blahtexml/default.nix b/pkgs/tools/typesetting/tex/blahtexml/default.nix index c71e983c563..43981eb2ae9 100644 --- a/pkgs/tools/typesetting/tex/blahtexml/default.nix +++ b/pkgs/tools/typesetting/tex/blahtexml/default.nix @@ -1,4 +1,4 @@ -{ fetchFromGitHub, lib, stdenv, libiconv, texlive, xercesc }: +{ fetchFromGitHub, lib, stdenv, libiconv, texliveFull, xercesc }: stdenv.mkDerivation rec { pname = "blahtexml"; @@ -11,9 +11,14 @@ stdenv.mkDerivation rec { hash = "sha256-DL5DyfARHHbwWBVHSa/VwHzNaAx/v7EDdnw1GLOk+y0="; }; + postPatch = lib.optionalString stdenv.cc.isClang '' + substituteInPlace makefile \ + --replace "\$(CXX)" "\$(CXX) -std=c++98" + ''; + outputs = [ "out" "doc" ]; - nativeBuildInputs = [ texlive.combined.scheme-full ]; # scheme-full needed for ucs package + nativeBuildInputs = [ texliveFull ]; # scheme-full needed for ucs package buildInputs = [ xercesc ] ++ lib.optionals stdenv.isDarwin [ libiconv ]; buildFlags = diff --git a/pkgs/tools/typesetting/tex/catdvi/default.nix b/pkgs/tools/typesetting/tex/catdvi/default.nix index ea2b49423f2..924aa57ece9 100644 --- a/pkgs/tools/typesetting/tex/catdvi/default.nix +++ b/pkgs/tools/typesetting/tex/catdvi/default.nix @@ -3,14 +3,13 @@ , fetchurl , fetchpatch , texlive +, texliveInfraOnly , buildPackages }: let buildPlatformTools = [ "pse2unic" "adobe2h" ]; - tex = texlive.combine { - inherit (texlive) collection-fontsrecommended; - }; + tex = texliveInfraOnly.withPackages (ps: [ ps.collection-fontsrecommended ]); in stdenv.mkDerivation (finalAttrs: { diff --git a/pkgs/tools/typesetting/tex/dblatex/default.nix b/pkgs/tools/typesetting/tex/dblatex/default.nix index 89eaf0346a4..1f3fd13d286 100644 --- a/pkgs/tools/typesetting/tex/dblatex/default.nix +++ b/pkgs/tools/typesetting/tex/dblatex/default.nix @@ -1,13 +1,13 @@ -{ lib, stdenv, fetchurl, python3, libxslt, texlive +{ lib, stdenv, fetchurl, python3, libxslt, texliveBasic , enableAllFeatures ? false, imagemagick, fig2dev, inkscape, fontconfig, ghostscript -, tex ? texlive.combine { # satisfy all packages that ./configure mentions - inherit (texlive) scheme-basic epstopdf anysize appendix changebar - fancybox fancyvrb float footmisc listings jknapltx/*for mathrsfs.sty*/ - multirow overpic pdfpages pdflscape graphics stmaryrd subfigure titlesec wasysym - # pkgs below don't seem requested by dblatex, but our manual fails without them - ec zapfding symbol eepic times rsfs cs tex4ht courier helvetic ly1; - } +, tex ? texliveBasic.withPackages (ps: with ps; [ # satisfy all packages that ./configure mentions + epstopdf anysize appendix changebar + fancybox fancyvrb float footmisc listings jknapltx/*for mathrsfs.sty*/ + multirow overpic pdfpages pdflscape graphics stmaryrd subfigure titlesec wasysym + # pkgs below don't seem requested by dblatex, but our manual fails without them + ec zapfding symbol eepic times rsfs cs tex4ht courier helvetic ly1 + ]) }: # NOTE: enableAllFeatures just purifies the expression, it doesn't actually diff --git a/pkgs/tools/typesetting/tex/mftrace/default.nix b/pkgs/tools/typesetting/tex/mftrace/default.nix index 4b8a0350c8b..7acc7c81b28 100644 --- a/pkgs/tools/typesetting/tex/mftrace/default.nix +++ b/pkgs/tools/typesetting/tex/mftrace/default.nix @@ -43,11 +43,7 @@ stdenv.mkDerivation (finalAttrs: rec { # experimental texlive.combine support # (note that only the bin/ folder will be combined into texlive) - passthru = { - tlType = "bin"; - tlDeps = with texlive; [ kpathsea t1utils metafont ]; - pkgs = [ finalAttrs.finalPackage ]; - }; + passthru.tlDeps = with texlive; [ kpathsea t1utils metafont ]; meta = with lib; { description = "Scalable PostScript Fonts for MetaFont"; diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix index ff4adcb78d2..2d7f859c809 100644 --- a/pkgs/tools/typesetting/tex/texlive/bin.nix +++ b/pkgs/tools/typesetting/tex/texlive/bin.nix @@ -310,12 +310,21 @@ chktex = stdenv.mkDerivation { }; -dvisvgm = stdenv.mkDerivation rec { +dvisvgm = stdenv.mkDerivation { pname = "texlive-dvisvgm.bin"; inherit version; inherit (common) src; + patches = [ + (fetchpatch { + url = "https://github.com/mgieseki/dvisvgm/commit/629544928877362d0c6d64f20695f7df3073c5eb.patch"; + stripLen = 1; + extraPrefix = "texk/dvisvgm/dvisvgm-src/"; + hash = "sha256-CBCbc/woaFeLw7aBG/kSVYc3a5Q56zbAB64kK6mRy4g="; + }) + ]; + preConfigure = "cd texk/dvisvgm"; configureFlags = common.configureFlags @@ -355,7 +364,7 @@ pygmentex = python3Packages.buildPythonApplication rec { inherit (src) version; format = "other"; - src = assertFixedHash pname (lib.head (builtins.filter (p: p.tlType == "run") texlive.pygmentex.pkgs)); + src = assertFixedHash pname texlive.pkgs.pygmentex.tex; propagatedBuildInputs = with python3Packages; [ pygments chardet ]; @@ -436,7 +445,7 @@ xdvi = stdenv.mkDerivation { xpdfopen = stdenv.mkDerivation { pname = "texlive-xpdfopen.bin"; - inherit (lib.head texlive.xpdfopen.pkgs) version; + inherit (texlive.pkgs.xpdfopen) version; inherit (common) src; diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/build-tex-env.nix index 8a326572716..133723cc391 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/build-tex-env.nix @@ -1,55 +1,126 @@ -{ lib, buildEnv, runCommand, writeText, makeWrapper, libfaketime, makeFontsConf -, perl, bash, coreutils, gnused, gnugrep, gawk, ghostscript -, bin, tl }: -# combine = -args@{ - pkgFilter ? (pkg: pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "core" - || pkg.hasManpages or false) -, extraName ? "combined" -, extraVersion ? "" -, ... +{ + # texlive package set + tl +, bin + +, lib +, buildEnv +, libfaketime +, makeFontsConf +, makeWrapper +, runCommand +, writeShellScript +, writeText +, toTLPkgSets +, bash +, perl + + # common runtime dependencies +, coreutils +, gawk +, gnugrep +, gnused +, ghostscript }: + +lib.fix (self: { + withDocs ? false +, withSources ? false +, requiredTeXPackages ? ps: [ ps.scheme-infraonly ] + +### texlive.combine backward compatibility +, __extraName ? "combined" +, __extraVersion ? "" +# emulate the old texlive.combine (e.g. add man pages to main output) +, __combine ? false +# adjust behavior further if called from the texlive.combine wrapper +, __fromCombineWrapper ? false +}@args: + let - # combine a set of TL packages into a single TL meta-package - combinePkgs = pkgList: lib.catAttrs "pkg" ( - let - # a TeX package is an attribute set { pkgs = [ ... ]; ... } where pkgs is a list of derivations - # the derivations make up the TeX package and optionally (for backward compatibility) its dependencies - tlPkgToSets = { pkgs, ... }: map ({ tlType, version ? "", outputName ? "", ... }@pkg: { - # outputName required to distinguish among bin.core-big outputs - key = "${pkg.pname or pkg.name}.${tlType}-${version}-${outputName}"; - inherit pkg; - }) pkgs; - pkgListToSets = lib.concatMap tlPkgToSets; in - builtins.genericClosure { - startSet = pkgListToSets pkgList; - operator = { pkg, ... }: pkgListToSets (pkg.tlDeps or []); - }); + ### texlive.combine backward compatibility + # if necessary, convert old style { pkgs = [ ... ]; } packages to attribute sets + isOldPkgList = p: ! p.outputSpecified or false && p ? pkgs && builtins.all (p: p ? tlType) p.pkgs; + ensurePkgSets = ps: if ! __fromCombineWrapper && builtins.any isOldPkgList ps + then let oldPkgLists = builtins.partition isOldPkgList ps; + in oldPkgLists.wrong ++ lib.concatMap toTLPkgSets oldPkgLists.right + else ps; - pkgSet = removeAttrs args [ "pkgFilter" "extraName" "extraVersion" ]; pkgList = rec { - combined = combinePkgs (lib.attrValues pkgSet); - all = lib.filter pkgFilter combined; - splitBin = builtins.partition (p: p.tlType == "bin") all; - bin = splitBin.right; - nonbin = splitBin.wrong; - tlpkg = lib.filter (pkg: pkg.tlType == "tlpkg") combined; + # resolve dependencies of the packages that affect the runtime + all = + let + # order of packages is irrelevant + packages = builtins.sort (a: b: a.pname < b.pname) (ensurePkgSets (requiredTeXPackages tl)); + runtime = builtins.partition + (p: p.outputSpecified or false -> builtins.elem (p.tlOutputName or p.outputName) [ "out" "tex" "tlpkg" ]) + packages; + keySet = p: { + key = ((p.name or "${p.pname}-${p.version}") + "-" + p.tlOutputName or p.outputName or ""); + inherit p; + tlDeps = p.tlDeps or (p.requiredTeXPackages or (_: [ ]) [ ]); + }; + in + # texlive.combine: the wrapper already resolves all dependencies + if __fromCombineWrapper then requiredTeXPackages null else + builtins.catAttrs "p" (builtins.genericClosure { + startSet = map keySet runtime.right; + operator = p: map keySet p.tlDeps; + }) ++ runtime.wrong; + + # group the specified outputs + specified = builtins.partition (p: p.outputSpecified or false) all; + specifiedOutputs = lib.groupBy (p: p.tlOutputName or p.outputName) specified.right; + otherOutputNames = builtins.catAttrs "key" (builtins.genericClosure { + startSet = map (key: { inherit key; }) (lib.concatLists (builtins.catAttrs "outputs" specified.wrong)); + operator = _: [ ]; + }); + otherOutputs = lib.genAttrs otherOutputNames (n: builtins.catAttrs n specified.wrong); + outputsToInstall = builtins.catAttrs "key" (builtins.genericClosure { + startSet = map (key: { inherit key; }) + ([ "out" ] ++ lib.optional (splitOutputs ? man) "man" + ++ lib.concatLists (builtins.catAttrs "outputsToInstall" (builtins.catAttrs "meta" specified.wrong))); + operator = _: [ ]; + }); + + # split binary and tlpkg from tex, texdoc, texsource + bin = if __fromCombineWrapper + then builtins.filter (p: p.tlType == "bin") all # texlive.combine: legacy filter + else otherOutputs.out or [ ] ++ specifiedOutputs.out or [ ]; + tlpkg = if __fromCombineWrapper + then builtins.filter (p: p.tlType == "tlpkg") all # texlive.combine: legacy filter + else otherOutputs.tlpkg or [ ] ++ specifiedOutputs.tlpkg or [ ]; + + nonbin = if __fromCombineWrapper then builtins.filter (p: p.tlType != "bin" && p.tlType != "tlpkg") all # texlive.combine: legacy filter + else (if __combine then # texlive.combine: emulate old input ordering to avoid rebuilds + lib.concatMap (p: lib.optional (p ? tex) p.tex + ++ lib.optional ((withDocs || p ? man) && p ? texdoc) p.texdoc + ++ lib.optional (withSources && p ? texsource) p.texsource) specified.wrong + else otherOutputs.tex or [ ] + ++ lib.optionals withDocs (otherOutputs.texdoc or [ ]) + ++ lib.optionals withSources (otherOutputs.texsource or [ ])) + ++ specifiedOutputs.tex or [ ] ++ specifiedOutputs.texdoc or [ ] ++ specifiedOutputs.texsource or [ ]; + + # outputs that do not become part of the environment + nonEnvOutputs = lib.subtractLists [ "out" "tex" "texdoc" "texsource" "tlpkg" ] otherOutputNames; }; + # list generated by inspecting `grep -IR '\([^a-zA-Z]\|^\)gs\( \|$\|"\)' "$TEXMFDIST"/scripts` # and `grep -IR rungs "$TEXMFDIST"` # and ignoring luatex, perl, and shell scripts (those must be patched using postFixup) needsGhostscript = lib.any (p: lib.elem p.pname [ "context" "dvipdfmx" "latex-papersize" "lyluatex" ]) pkgList.bin; - name = "texlive-${extraName}-${bin.texliveYear}${extraVersion}"; + name = if __combine then "texlive-${__extraName}-${bin.texliveYear}${__extraVersion}" # texlive.combine: old name name + else "texlive-${bin.texliveYear}-env"; texmfdist = (buildEnv { name = "${name}-texmfdist"; # remove fake derivations (without 'outPath') to avoid undesired build dependencies - paths = lib.catAttrs "outPath" pkgList.nonbin; + paths = builtins.catAttrs "outPath" pkgList.nonbin; # mktexlsr - nativeBuildInputs = [ (lib.last tl."texlive.infra".pkgs) ]; + nativeBuildInputs = [ tl."texlive.infra" ]; postBuild = # generate ls-R database '' @@ -61,7 +132,7 @@ let name = "${name}-tlpkg"; # remove fake derivations (without 'outPath') to avoid undesired build dependencies - paths = lib.catAttrs "outPath" pkgList.tlpkg; + paths = builtins.catAttrs "outPath" pkgList.tlpkg; }).overrideAttrs (_: { allowSubstitutes = true; }); # the 'non-relocated' packages must live in $TEXMFROOT/texmf-dist @@ -74,7 +145,7 @@ let ln -s "$tlpkg" "$out"/tlpkg ''; - # expose info and man pages in usual /share/{info,man} location + # texlive.combine: expose info and man pages in usual /share/{info,man} location doc = buildEnv { name = "${name}-doc"; @@ -87,14 +158,67 @@ let ]; }; -in (buildEnv { + meta = { + description = "TeX Live environment" + + lib.optionalString withDocs " with documentation" + + lib.optionalString (withDocs && withSources) " and" + + lib.optionalString withSources " with sources"; + platforms = lib.platforms.all; + longDescription = "Contains the following packages and their transitive dependencies:\n - " + + lib.concatMapStringsSep "\n - " + (p: p.pname + (lib.optionalString (p.outputSpecified or false) " (${p.tlOutputName or p.outputName})")) + (requiredTeXPackages tl); + }; + + # emulate split output derivation + splitOutputs = { + out = out // { outputSpecified = true; }; + texmfdist = texmfdist // { outputSpecified = true; }; + texmfroot = texmfroot // { outputSpecified = true; }; + } // (lib.genAttrs pkgList.nonEnvOutputs (outName: (buildEnv { + inherit name; + paths = builtins.catAttrs "outPath" + (pkgList.otherOutputs.${outName} or [ ] ++ pkgList.specifiedOutputs.${outName} or [ ]); + # force the output to be ${outName} or nix-env will not work + nativeBuildInputs = [ (writeShellScript "force-output.sh" '' + export out="''${${outName}-}" + '') ]; + inherit meta passthru; + }).overrideAttrs { outputs = [ outName ]; } // { outputSpecified = true; })); + + passthru = lib.optionalAttrs (! __combine) (splitOutputs // { + all = builtins.attrValues splitOutputs; + outputs = [ "out" ] ++ pkgList.nonEnvOutputs; + }) // { + # This is set primarily to help find-tarballs.nix to do its job + requiredTeXPackages = builtins.filter lib.isDerivation (pkgList.bin ++ pkgList.nonbin + ++ lib.optionals (! __fromCombineWrapper) + (lib.concatMap (n: (pkgList.otherOutputs.${n} or [ ] ++ pkgList.specifiedOutputs.${n} or [ ]))) pkgList.nonEnvOutputs); + # useful for inclusion in the `fonts.packages` nixos option or for use in devshells + fonts = "${texmfroot}/texmf-dist/fonts"; + # support variants attrs, (prev: attrs) + __overrideTeXConfig = newArgs: + let appliedArgs = if builtins.isFunction newArgs then newArgs args else newArgs; in + self (args // { __fromCombineWrapper = false; } // appliedArgs); + withPackages = reqs: self (args // { requiredTeXPackages = ps: requiredTeXPackages ps ++ reqs ps; __fromCombineWrapper = false; }); + }; + + out = (if (! __combine) + # meta.outputsToInstall = [ "out" "man" ] is invalid within buildEnv: + # checkMeta will notice that there is no actual "man" output, and fail + # so we set outputsToInstall from the outside, where it is safe + then lib.addMetaAttrs { inherit (pkgList) outputsToInstall; } + else x: x) # texlive.combine: man pages used to be part of out +# no indent for git diff purposes +((buildEnv { inherit name; ignoreCollisions = false; # remove fake derivations (without 'outPath') to avoid undesired build dependencies - paths = lib.catAttrs "outPath" pkgList.bin ++ [ doc ]; + paths = builtins.catAttrs "outPath" pkgList.bin + ++ lib.optional __combine doc; pathsToLink = [ "/" "/share/texmf-var/scripts" @@ -107,18 +231,13 @@ in (buildEnv { nativeBuildInputs = [ makeWrapper libfaketime - (lib.last tl."texlive.infra".pkgs) # mktexlsr - (lib.last tl.texlive-scripts.pkgs) # fmtutil, updmap - (lib.last tl.texlive-scripts-extra.pkgs) # texlinks + tl."texlive.infra" # mktexlsr + tl.texlive-scripts # fmtutil, updmap + tl.texlive-scripts-extra # texlinks perl ]; - passthru = { - # This is set primarily to help find-tarballs.nix to do its job - packages = pkgList.all; - # useful for inclusion in the `fonts.packages` nixos option or for use in devshells - fonts = "${texmfroot}/texmf-dist/fonts"; - }; + inherit meta passthru; postBuild = # environment variables (note: only export the ones that are used in the wrappers) @@ -131,7 +250,7 @@ in (buildEnv { export TEXMFCNF="$TEXMFSYSVAR/web2c" '' + # wrap executables with required env vars as early as possible - # 1. we want texlive.combine to use the wrapped binaries, to catch bugs + # 1. we use the wrapped binaries in the scripts below, to catch bugs # 2. we do not want to wrap links generated by texlinks '' enable -f '${bash}/lib/bash/realpath' realpath @@ -195,16 +314,16 @@ in (buildEnv { '' + # now filter hyphenation patterns and formats (let - hyphens = lib.filter (p: p.hasHyphens or false && p.tlType == "run") pkgList.splitBin.wrong; + hyphens = lib.filter (p: p.hasHyphens or false && p.tlOutputName or p.outputName == "tex") pkgList.nonbin; hyphenPNames = map (p: p.pname) hyphens; - formats = lib.filter (p: p ? formats && p.tlType == "run") pkgList.splitBin.wrong; + formats = lib.filter (p: p ? formats && p.tlOutputName or p.outputName == "tex") pkgList.nonbin; 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 = writeText "hyphens.sed" ( # document how the file was generated (for language.dat) - "1{ s/^(% Generated by .*)$/\\1, modified by texlive.combine/; p; }\n" + "1{ s/^(% Generated by .*)$/\\1, modified by ${if __combine then "texlive.combine" else "Nixpkgs"}/; p; }\n" # pick up the header + "2,/^% from/{ /^% from/!p; };\n" # pick up all sections matching packages that we combine @@ -214,7 +333,7 @@ in (buildEnv { ); scriptLua = writeText "hyphens.lua.sed" ( - "1{ s/^(-- Generated by .*)$/\\1, modified by texlive.combine/; p; }\n" + "1{ s/^(-- Generated by .*)$/\\1, modified by ${if __combine then "texlive.combine" else "Nixpkgs"}/; p; }\n" + "2,/^-- END of language.us.lua/p;\n" + lib.concatMapStrings (pname: section "^-- from ${pname}:$" "^}$|^-- from") hyphenPNames + "$p;\n" @@ -225,7 +344,7 @@ in (buildEnv { fmtutilSed = writeText "fmtutil.sed" ( # document how file was generated - "1{ s/^(# Generated by .*)$/\\1, modified by texlive.combine/; }\n" + "1{ s/^(# Generated by .*)$/\\1, modified by ${if __combine then "texlive.combine" else "Nixpkgs"}/; }\n" # disable all formats, even those already disabled + "s/^([^#]|#! )/#! \\1/;\n" # enable the formats from the packages being installed @@ -312,4 +431,5 @@ in (buildEnv { ln -s "$TEXMFDIST" "$out"/share/texmf '' ; -}).overrideAttrs (_: { allowSubstitutes = true; }) +}).overrideAttrs (_: { allowSubstitutes = true; })); +in out) diff --git a/pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix b/pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix index c1e98d710b9..efbb3a1fb56 100644 --- a/pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix +++ b/pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix @@ -15,17 +15,27 @@ , texliveBinaries }: +/* Convert an attribute set extracted from tlpdb.nix (with the deps attribute + already processed) to a fake multi-output derivation with possible outputs + [ "tex" "texdoc" "texsource" "tlpkg" "out" "man" "info" ] +*/ + +# TODO stabilise a generic interface decoupled from the finer details of the +# translation from texlive.tlpdb to tlpdb.nix { pname , revision , version ? toString revision +, extraRevision ? "" +, extraVersion ? "" , sha512 , mirrors -, extraVersion ? "" , fixedHashes ? { } , postUnpack ? "" +, postFixup ? "" , stripPrefix ? 1 , license ? [ ] , hasHyphens ? false +, hasInfo ? false , hasManpages ? false , hasRunfiles ? false , hasTlpkg ? false @@ -34,112 +44,165 @@ }@args: let - meta = { license = map (x: lib.licenses.${x}) license; }; - - commonPassthru = { - inherit pname revision version; - } // lib.optionalAttrs (args ? extraRevision) { - inherit (args) extraRevision; + # common metadata + name = "${pname}-${version}${extraVersion}"; + meta = { + license = map (x: lib.licenses.${x}) license; + # TeX Live packages should not be installed directly into the user profile + outputsToInstall = [ ]; }; + hasBinfiles = args ? binfiles && args.binfiles != [ ]; + hasDocfiles = sha512 ? doc; + hasSource = sha512 ? source; + + # emulate drv.all, drv.outputs lists + all = lib.optional hasBinfiles bin ++ + lib.optional hasRunfiles tex ++ + lib.optional hasDocfiles texdoc ++ + lib.optional hasSource texsource ++ + lib.optional hasTlpkg tlpkg ++ + lib.optional hasManpages man ++ + lib.optional hasInfo info; + outputs = lib.catAttrs "tlOutputName" all; + + mainDrv = if hasBinfiles then bin + else if hasRunfiles then tex + else if hasTlpkg then tlpkg + else if hasDocfiles then texdoc + else if hasSource then texsource + else tex; # fall back to attrset tex if there is no derivation + + # emulate multi-output derivation plus additional metadata + # (out is handled in mkContainer) + passthru = { + inherit all outputs pname; + revision = toString revision + extraRevision; + version = version + extraVersion; + outputSpecified = true; + inherit tex; + } // lib.optionalAttrs (args ? deps) { tlDeps = args.deps; } + // lib.optionalAttrs (args ? formats) { inherit (args) formats; } + // lib.optionalAttrs hasHyphens { inherit hasHyphens; } + // lib.optionalAttrs (args ? postactionScript) { inherit (args) postactionScript; } + // lib.optionalAttrs hasDocfiles { texdoc = texdoc; } + // lib.optionalAttrs hasSource { texsource = texsource; } + // lib.optionalAttrs hasTlpkg { tlpkg = tlpkg; } + // lib.optionalAttrs hasManpages { man = man; } + // lib.optionalAttrs hasInfo { info = info; }; + # build run, doc, source, tlpkg containers - mkContainer = tlType: passthru: sha512: + mkContainer = tlType: tlOutputName: sha512: let - # NOTE: the fixed naming scheme must match generated-fixed-hashes.nix + fixedHash = fixedHashes.${tlType} or null; # be graceful about missing hashes # the basename used by upstream (without ".tar.xz" suffix) + # tlpkg is not a true container but a subfolder of the run container urlName = pname + (lib.optionalString (tlType != "run" && tlType != "tlpkg") ".${tlType}"); - # name + version for the derivation - tlName = urlName + (lib.optionalString (tlType == "tlpkg") ".tlpkg") + "-${version}${extraVersion}"; - fixedHash = fixedHashes.${tlType} or null; # be graceful about missing hashes - - urls = args.urls or (if args ? url then [ args.url ] else - map (up: "${up}/archive/${urlName}.r${toString revision}.tar.xz") mirrors); + urls = map (up: "${up}/archive/${urlName}.r${toString revision}.tar.xz") mirrors; + # TODO switch to simpler "${name}-${tlOutputName}" (requires new fixed hashes) + container = runCommand "texlive-${pname}${lib.optionalString (tlType != "run") ".${tlType}"}-${version}${extraVersion}" + ({ + src = fetchurl { inherit urls sha512; }; + # save outputName as fixed output derivations cannot change nor override outputName + passthru = passthru // { inherit tlOutputName; }; + # TODO remove tlType from derivation (requires a rebuild) + inherit meta stripPrefix tlType; + } // lib.optionalAttrs (fixedHash != null) { + outputHash = fixedHash; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + }) + ('' + mkdir "$out" + if [[ "$tlType" == "tlpkg" ]]; then + tar -xf "$src" \ + --strip-components=1 \ + -C "$out" --anchored --exclude=tlpkg/tlpobj --keep-old-files \ + tlpkg + else + tar -xf "$src" \ + --strip-components="$stripPrefix" \ + -C "$out" --anchored --exclude=tlpkg --keep-old-files + fi + '' + postUnpack); in - runCommand "texlive-${tlName}" - ({ - src = fetchurl { inherit urls sha512; }; - inherit meta passthru stripPrefix tlType; - } // lib.optionalAttrs (fixedHash != null) { - outputHash = fixedHash; - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - }) - ('' - mkdir "$out" - if [[ "$tlType" == "tlpkg" ]]; then - tar -xf "$src" \ - --strip-components=1 \ - -C "$out" --anchored --exclude=tlpkg/tlpobj --keep-old-files \ - tlpkg - else - tar -xf "$src" \ - --strip-components="$stripPrefix" \ - -C "$out" --anchored --exclude=tlpkg --keep-old-files - fi - '' + postUnpack); - - tex = [ - ( - let passthru = commonPassthru - // lib.optionalAttrs (args ? deps) { tlDeps = args.deps; } - // lib.optionalAttrs (args ? formats) { inherit (args) formats; } - // lib.optionalAttrs hasHyphens { inherit hasHyphens; }; in - if hasRunfiles then mkContainer "run" passthru sha512.run - else (passthru // { tlType = "run"; }) - ) - ]; - - doc = let passthru = commonPassthru - // lib.optionalAttrs hasManpages { inherit hasManpages; }; in - lib.optional (sha512 ? doc) (mkContainer "doc" passthru sha512.doc); - - source = lib.optional (sha512 ? source) (mkContainer "source" commonPassthru sha512.source); - - tlpkg = let passthru = commonPassthru - // lib.optionalAttrs (args ? postactionScript) { postactionScript = args.postactionScript; }; in - lib.optional hasTlpkg (mkContainer "tlpkg" passthru sha512.run); - - bin = lib.optional (args ? binfiles && args.binfiles != [ ]) ( - let - # find interpreters for the script extensions found in tlpdb - extToInput = { - jar = jdk; - lua = texliveBinaries.luatex; - py = python3; - rb = ruby; - sno = snobol4; - tcl = tk; - texlua = texliveBinaries.luatex; - tlu = texliveBinaries.luatex; - }; - run = lib.head tex; - in - runCommand "texlive-${pname}.bin-${version}" - { - passthru = commonPassthru // { tlType = "bin"; }; - inherit meta; - # shebang interpreters and compiled binaries - buildInputs = let outName = builtins.replaceStrings [ "-" ] [ "_" ] pname; in - [ texliveBinaries.core.${outName} or null - texliveBinaries.${pname} or null - texliveBinaries.core-big.${outName} or null ] - ++ (args.extraBuildInputs or [ ]) ++ [ bash perl ] - ++ (lib.attrVals (args.scriptExts or [ ]) extToInput); - nativeBuildInputs = extraNativeBuildInputs; - # absolute scripts folder - scriptsFolder = lib.optionalString (run ? outPath) (run.outPath + "/scripts/" + args.scriptsFolder or pname); - # binaries info - inherit (args) binfiles; - binlinks = builtins.attrNames (args.binlinks or { }); - bintargets = builtins.attrValues (args.binlinks or { }); - # build scripts - patchScripts = ./patch-scripts.sed; - makeBinContainers = ./make-bin-containers.sh; - } - '' - . "$makeBinContainers" - ${args.postFixup or ""} - '' - ); + # remove the standard drv.out, optionally replace it with the bin container + builtins.removeAttrs container [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; + + tex = + if hasRunfiles then mkContainer "run" "tex" sha512.run + else passthru + // { inherit meta; tlOutputName = "tex"; } + // lib.optionalAttrs hasBinfiles { out = bin; }; + + texdoc = mkContainer "doc" "texdoc" sha512.doc; + + texsource = mkContainer "source" "texsource" sha512.source; + + tlpkg = mkContainer "tlpkg" "tlpkg" sha512.run; + + # build bin container + extToInput = { + # find interpreters for the script extensions found in tlpdb + jar = jdk; + lua = texliveBinaries.luatex; + py = python3; + rb = ruby; + sno = snobol4; + tcl = tk; + texlua = texliveBinaries.luatex; + tlu = texliveBinaries.luatex; + }; + + # TODO switch to simpler "${name}" (requires a rebuild) + bin = runCommand "texlive-${pname}.bin-${version}" + { + inherit meta; + passthru = passthru // { tlOutputName = "out"; }; + # shebang interpreters + buildInputs =let outName = builtins.replaceStrings [ "-" ] [ "_" ] pname; in + [ texliveBinaries.core.${outName} or null + texliveBinaries.${pname} or null + texliveBinaries.core-big.${outName} or null ] + ++ (args.extraBuildInputs or [ ]) ++ [ bash perl ] + ++ (lib.attrVals (args.scriptExts or [ ]) extToInput); + nativeBuildInputs = extraNativeBuildInputs; + # absolute scripts folder + scriptsFolder = lib.optionalString (tex ? outPath) (tex.outPath + "/scripts/" + args.scriptsFolder or pname); + # binaries info + inherit (args) binfiles; + binlinks = builtins.attrNames (args.binlinks or { }); + bintargets = builtins.attrValues (args.binlinks or { }); + # build scripts + patchScripts = ./patch-scripts.sed; + makeBinContainers = ./make-bin-containers.sh; + } + '' + . "$makeBinContainers" + ${args.postFixup or ""} + ''; + + # build man, info containers + # TODO switch to simpler "${name}-man" (requires a rebuild) + man = builtins.removeAttrs (runCommand "texlive-${pname}.man-${version}${extraVersion}" + { + inherit meta texdoc; + passthru = passthru // { tlOutputName = "man"; }; + } + '' + mkdir -p "$out"/share + ln -s {"$texdoc"/doc,"$out"/share}/man + '') [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; + + # TODO switch to simpler "${name}-info" (requires a rebuild) + info = builtins.removeAttrs (runCommand "texlive-${pname}.info-${version}${extraVersion}" + { + inherit meta texdoc; + passthru = passthru // { tlOutputName = "info"; }; + } + '' + mkdir -p "$out"/share + ln -s {"$texdoc"/doc,"$out"/share}/info + '') [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; in -{ pkgs = tex ++ doc ++ source ++ tlpkg ++ bin; } +builtins.removeAttrs mainDrv [ "outputSpecified" ] diff --git a/pkgs/tools/typesetting/tex/texlive/combine-wrapper.nix b/pkgs/tools/typesetting/tex/texlive/combine-wrapper.nix new file mode 100644 index 00000000000..165e7a22c66 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/combine-wrapper.nix @@ -0,0 +1,42 @@ +# legacy texlive.combine wrapper +{ lib, toTLPkgList, toTLPkgSets, buildTeXEnv }: +args@{ + pkgFilter ? (pkg: pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "core" + || pkg.hasManpages or false) +, extraName ? "combined" +, extraVersion ? "" +, ... +}: +let + pkgSet = removeAttrs args [ "pkgFilter" "extraName" "extraVersion" ]; + + # combine a set of TL packages into a single TL meta-package + combinePkgs = pkgList: lib.catAttrs "pkg" ( + let + # a TeX package used to be an attribute set { pkgs = [ ... ]; ... } where pkgs is a list of derivations + # the derivations make up the TeX package and optionally (for backward compatibility) its dependencies + tlPkgToSets = drv: map ({ tlType, version ? "", outputName ? "", ... }@pkg: { + # outputName required to distinguish among bin.core-big outputs + key = "${pkg.pname or pkg.name}.${tlType}-${version}-${outputName}"; + inherit pkg; + }) (drv.pkgs or (toTLPkgList drv)); + pkgListToSets = lib.concatMap tlPkgToSets; in + builtins.genericClosure { + startSet = pkgListToSets pkgList; + operator = { pkg, ... }: pkgListToSets (pkg.tlDeps or []); + }); + combined = combinePkgs (lib.attrValues pkgSet); + + # convert to specified outputs + tlTypeToOut = { run = "tex"; doc = "texdoc"; source = "texsource"; bin = "out"; tlpkg = "tlpkg"; }; + toSpecified = { tlType, ... }@drv: drv // { outputSpecified = true; tlOutputName = tlTypeToOut.${tlType}; }; + all = lib.filter pkgFilter combined ++ lib.filter (pkg: pkg.tlType == "tlpkg") combined; + converted = builtins.map toSpecified all; +in +buildTeXEnv { + __extraName = extraName; + __extraVersion = extraVersion; + requiredTeXPackages = _: converted; + __combine = true; + __fromCombineWrapper = true; +} diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix index 60e7043e332..1a497c6affa 100644 --- a/pkgs/tools/typesetting/tex/texlive/default.nix +++ b/pkgs/tools/typesetting/tex/texlive/default.nix @@ -2,11 +2,11 @@ - source: ../../../../../doc/languages-frameworks/texlive.xml - current html: https://nixos.org/nixpkgs/manual/#sec-language-texlive */ -{ stdenv, lib, fetchurl, runCommand, writeText, buildEnv +{ stdenv, lib, fetchurl, runCommand, writeShellScript, writeText, buildEnv , callPackage, ghostscript_headless, harfbuzz , makeWrapper, installShellFiles , python3, ruby, perl, tk, jdk, bash, snobol4 -, coreutils, findutils, gawk, getopt, gnugrep, gnumake, gnupg, gnused, gzip, ncurses, zip +, coreutils, findutils, gawk, getopt, gnugrep, gnumake, gnupg, gnused, gzip, html-tidy, ncurses, zip , libfaketime, asymptote, biber-ms, makeFontsConf , useFixedHashes ? true , recurseIntoAttrs @@ -22,13 +22,6 @@ let tlpdb = overriddenTlpdb; }; - # function for creating a working environment from a set of TL packages - combine = import ./combine.nix { - inherit bin buildEnv lib makeWrapper writeText runCommand - perl libfaketime makeFontsConf bash tl coreutils gawk gnugrep gnused; - ghostscript = ghostscript_headless; - }; - tlpdb = import ./tlpdb.nix; tlpdbVersion = tlpdb."00texlive.config"; @@ -40,7 +33,7 @@ let stdenv lib bin tlpdb tlpdbxz tl installShellFiles coreutils findutils gawk getopt ghostscript_headless gnugrep - gnumake gnupg gnused gzip ncurses perl python3 ruby zip; + gnumake gnupg gnused gzip html-tidy ncurses perl python3 ruby zip; }; in overrides tlpdb; @@ -101,12 +94,114 @@ let // lib.optionalAttrs (args ? deps) { deps = map (n: tl.${n}) (args.deps or [ ]); }) ) overriddenTlpdb; + # function for creating a working environment + buildTeXEnv = import ./build-tex-env.nix { + inherit bin tl; + ghostscript = ghostscript_headless; + inherit lib buildEnv libfaketime makeFontsConf makeWrapper runCommand + writeShellScript writeText toTLPkgSets bash perl coreutils gawk gnugrep gnused; + }; + + ### 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"; }; + + # convert { pkgs = [ ... ]; } lists to TeX packages + # possibly more than one, if pkgs is also used to specify dependencies + tlTypeToOut = { run = "tex"; doc = "texdoc"; source = "texsource"; bin = "out"; tlpkg = "tlpkg"; }; + toSpecifiedNV = p: rec { + name = value.tlOutputName; + value = builtins.removeAttrs p [ "pkgs" ] + // { outputSpecified = true; tlOutputName = tlTypeToOut.${p.tlType}; }; + }; + toTLPkgSet = pname: drvs: + let set = lib.listToAttrs (builtins.map toSpecifiedNV drvs); + mainDrv = set.out or set.tex or set.tlpkg or set.texdoc or set.texsource; in + builtins.removeAttrs mainDrv [ "outputSpecified" ]; + toTLPkgSets = { pkgs, ... }: lib.mapAttrsToList toTLPkgSet + (builtins.groupBy (p: p.pname) pkgs); + + # export TeX packages as { pkgs = [ ... ]; } in the top attribute set + allPkgLists = lib.mapAttrs (n: drv: { pkgs = toTLPkgList drv; }) tl; + + # function for creating a working environment from a set of TL packages + # now a legacy wrapper around buildTeXEnv + combine = import ./combine-wrapper.nix { inherit buildTeXEnv lib toTLPkgList toTLPkgSets; }; + 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"; + # Pre-defined evironment packages for TeX Live schemes, + # to make nix-env usage more comfortable and build selected on Hydra. + + # these license lists should be the sorted union of the licenses of the packages the schemes contain. + # The correctness of this collation is tested by tests.texlive.licenses + licenses = with lib.licenses; { + scheme-basic = [ free gfl gpl1Only gpl2 gpl2Plus knuth lgpl21 lppl1 lppl13c mit ofl publicDomain ]; + scheme-bookpub = [ artistic2 asl20 fdl13Only free gfl gpl1Only gpl2 gpl2Plus knuth lgpl21 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain ]; + scheme-context = [ bsd2 bsd3 cc-by-sa-40 free gfl gfsl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus knuth lgpl2 lgpl21 + lppl1 lppl13c mit ofl publicDomain x11 ]; + scheme-full = [ artistic1-cl8 artistic2 asl20 bsd2 bsd3 bsdOriginal cc-by-10 cc-by-40 cc-by-sa-10 cc-by-sa-20 + cc-by-sa-30 cc-by-sa-40 cc0 fdl13Only free gfl gfsl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth + lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ]; + scheme-gust = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-40 cc0 fdl13Only free gfl gfsl gpl1Only gpl2 + gpl2Plus gpl3 gpl3Plus knuth lgpl2 lgpl21 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ]; + scheme-infraonly = [ gpl2 gpl2Plus lgpl21 ]; + scheme-medium = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-20 cc-by-sa-30 cc-by-sa-40 cc0 fdl13Only + free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a lppl13c mit ofl + publicDomain x11 ]; + scheme-minimal = [ free gpl1Only gpl2 gpl2Plus knuth lgpl21 lppl1 lppl13c mit ofl publicDomain ]; + scheme-small = [ asl20 cc-by-40 cc-by-sa-40 cc0 fdl13Only free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus knuth + lgpl2 lgpl21 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ]; + scheme-tetex = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-10 cc-by-sa-20 cc-by-sa-30 cc-by-sa-40 cc0 + fdl13Only free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a + lppl13c mit ofl publicDomain x11]; + }; + + meta = { + description = "TeX Live environment"; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ veprbl ]; + license = licenses.scheme-infraonly; + }; + + combined = recurseIntoAttrs ( + lib.genAttrs [ "scheme-basic" "scheme-bookpub" "scheme-context" "scheme-full" "scheme-gust" "scheme-infraonly" + "scheme-medium" "scheme-minimal" "scheme-small" "scheme-tetex" ] + (pname: + (buildTeXEnv { + __extraName = "combined" + lib.removePrefix "scheme" pname; + __extraVersion = with version; if final then "-final" else ".${year}${month}${day}"; + requiredTeXPackages = ps: [ ps.${pname} ]; + # to maintain full backward compatibility, enable texlive.combine behavior + __combine = true; + }).overrideAttrs { + meta = meta // { + description = "TeX Live environment for ${pname}"; + license = licenses.${pname}; + }; + } + ) + ); + + schemes = lib.listToAttrs (map (s: { + name = "texlive" + s; + value = lib.addMetaAttrs { license = licenses.${"scheme-" + (lib.toLower s)}; } (buildTeXEnv { requiredTeXPackages = ps: [ ps.${"scheme-" + (lib.toLower s)} ]; }); + }) [ "Basic" "BookPub" "ConTeXt" "Full" "GUST" "InfraOnly" "Medium" "Minimal" "Small" "TeTeX" ]); + in - tl // { + allPkgLists // { + pkgs = tl; tlpdb = { # nested in an attribute set to prevent them from appearing in search @@ -116,55 +211,15 @@ 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; - # Pre-defined combined packages for TeX Live schemes, - # to make nix-env usage more comfortable and build selected on Hydra. - combined = with lib; - let - # these license lists should be the sorted union of the licenses of the packages the schemes contain. - # The correctness of this collation is tested by tests.texlive.licenses - licenses = with lib.licenses; { - scheme-basic = [ free gfl gpl1Only gpl2 gpl2Plus knuth lgpl21 lppl1 lppl13c mit ofl publicDomain ]; - scheme-context = [ bsd2 bsd3 cc-by-sa-40 free gfl gfsl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus knuth lgpl2 lgpl21 - lppl1 lppl13c mit ofl publicDomain x11 ]; - scheme-full = [ artistic1-cl8 artistic2 asl20 bsd2 bsd3 bsdOriginal cc-by-10 cc-by-40 cc-by-sa-10 cc-by-sa-20 - cc-by-sa-30 cc-by-sa-40 cc0 fdl13Only free gfl gfsl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth - lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ]; - scheme-gust = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-40 cc0 fdl13Only free gfl gfsl gpl1Only gpl2 - gpl2Plus gpl3 gpl3Plus knuth lgpl2 lgpl21 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ]; - scheme-infraonly = [ gpl2 gpl2Plus lgpl21 ]; - scheme-medium = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-20 cc-by-sa-30 cc-by-sa-40 cc0 fdl13Only - free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a lppl13c mit ofl - publicDomain x11 ]; - scheme-minimal = [ free gpl1Only gpl2 gpl2Plus knuth lgpl21 lppl1 lppl13c mit ofl publicDomain ]; - scheme-small = [ asl20 cc-by-40 cc-by-sa-40 cc0 fdl13Only free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus knuth - lgpl2 lgpl21 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ]; - scheme-tetex = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-10 cc-by-sa-20 cc-by-sa-30 cc-by-sa-40 cc0 - fdl13Only free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a - lppl13c mit ofl publicDomain x11]; - }; - in recurseIntoAttrs ( - mapAttrs - (pname: attrs: - addMetaAttrs rec { - description = "TeX Live environment for ${pname}"; - platforms = lib.platforms.all; - maintainers = with lib.maintainers; [ veprbl ]; - license = licenses.${pname}; - } - (combine { - ${pname} = attrs; - extraName = "combined" + lib.removePrefix "scheme" pname; - extraVersion = with version; if final then "-final" else ".${year}${month}${day}"; - }) - ) - { inherit (tl) - scheme-basic scheme-context scheme-full scheme-gust scheme-infraonly - scheme-medium scheme-minimal scheme-small scheme-tetex; - } - ); + combined = assert assertions; combined; + + inherit schemes; + + # convenience alias + withPackages = (buildTeXEnv { }).withPackages; } diff --git a/pkgs/tools/typesetting/tex/texlive/generate-fixed-hashes.nix b/pkgs/tools/typesetting/tex/texlive/generate-fixed-hashes.nix index dedb877448a..532e3c5cfaf 100644 --- a/pkgs/tools/typesetting/tex/texlive/generate-fixed-hashes.nix +++ b/pkgs/tools/typesetting/tex/texlive/generate-fixed-hashes.nix @@ -1,13 +1,13 @@ with import ../../../../.. { }; with lib; let - isFod = p: p.tlType != "bin" && isDerivation p; + getFods = drv: lib.optional (isDerivation drv.tex) (drv.tex // { tlType = "run"; }) + ++ lib.optional (drv ? texdoc) (drv.texdoc // { tlType = "doc"; }) + ++ lib.optional (drv ? texsource) (drv.texsource // { tlType = "source"; }) + ++ lib.optional (drv ? tlpkg) (drv.tlpkg // { tlType = "tlpkg"; }); - # ugly hack to extract combine from collection-latexextra, since it is masked by texlive.combine - combine = lib.findFirst (p: (lib.head p.pkgs).pname == "combine") { pkgs = [ ]; } (lib.head texlive.collection-latexextra.pkgs).tlDeps; - all = filter (p: p ? pkgs) (attrValues (removeAttrs texlive [ "bin" "combine" "combined" "tlpdb" ])) ++ [ combine ]; - sorted = sort (a: b: (head a.pkgs).pname < (head b.pkgs).pname) all; - fods = filter isFod (concatMap (p: p.pkgs or [ ]) all); + sorted = sort (a: b: a.pname < b.pname) (attrValues texlive.pkgs); + fods = concatMap getFods sorted; computeHash = fod: runCommand "${fod.pname}-${fod.tlType}-fixed-hash" { buildInputs = [ nix ]; inherit fod; } @@ -15,18 +15,17 @@ with lib; let hash = fod: fod.outputHash or (builtins.readFile (computeHash fod)); - hashes = { pkgs }: - concatMapStrings ({ tlType, ... }@p: lib.optionalString (isFod p) (''${tlType}="${hash p}";'')) pkgs; + hashes = fods: + concatMapStrings ({ tlType, ... }@p: ''${tlType}="${hash p}";'') fods; - hashLine = { pkgs }@pkg: + hashLine = { pname, revision, extraRevision ? "", ... }@drv: let - fods = lib.filter isFod pkgs; - first = lib.head fods; + fods = getFods drv; # NOTE: the fixed naming scheme must match default.nix - fixedName = with first; "${pname}-${toString revision}${first.extraRevision or ""}"; + fixedName = "${pname}-${toString revision}${extraRevision}"; in - lib.optionalString (fods != [ ]) '' - ${strings.escapeNixIdentifier fixedName}={${hashes pkg}}; + optionalString (fods != [ ]) '' + ${strings.escapeNixIdentifier fixedName}={${hashes fods}}; ''; in { @@ -37,6 +36,6 @@ in fixedHashesNix = writeText "fixed-hashes.nix" '' { - ${lib.concatMapStrings hashLine sorted}} + ${concatMapStrings hashLine sorted}} ''; } diff --git a/pkgs/tools/typesetting/tex/texlive/tl2nix.sed b/pkgs/tools/typesetting/tex/texlive/tl2nix.sed index 7c8520707a9..244f8fbcc15 100644 --- a/pkgs/tools/typesetting/tex/texlive/tl2nix.sed +++ b/pkgs/tools/typesetting/tex/texlive/tl2nix.sed @@ -91,6 +91,7 @@ $a} t next-doc # loop if the previous lines matched / (texmf-dist|RELOC)\/doc\/man\//i\ hasManpages = true; + / (texmf-dist|RELOC)\/doc\/info\//i\ hasInfo = true; D # restart cycle } diff --git a/pkgs/tools/typesetting/tex/texlive/tlpdb-overrides.nix b/pkgs/tools/typesetting/tex/texlive/tlpdb-overrides.nix index 6b974c72143..83f07016bcd 100644 --- a/pkgs/tools/typesetting/tex/texlive/tlpdb-overrides.nix +++ b/pkgs/tools/typesetting/tex/texlive/tlpdb-overrides.nix @@ -1,7 +1,7 @@ { stdenv, lib, tlpdb, bin, tlpdbxz, tl , installShellFiles , coreutils, findutils, gawk, getopt, ghostscript_headless, gnugrep -, gnumake, gnupg, gnused, gzip, ncurses, perl, python3, ruby, zip +, gnumake, gnupg, gnused, gzip, html-tidy, ncurses, perl, python3, ruby, zip }: oldTlpdb: @@ -88,6 +88,7 @@ in lib.recursiveUpdate orig rec { pkfix-helper.extraBuildInputs = [ ghostscript_headless ]; ps2eps.extraBuildInputs = [ ghostscript_headless ]; pst2pdf.extraBuildInputs = [ ghostscript_headless ]; + tex4ebook.extraBuildInputs = [ html-tidy ]; tex4ht.extraBuildInputs = [ ruby ]; texlive-scripts.extraBuildInputs = [ gnused ]; texlive-scripts-extra.extraBuildInputs = [ coreutils findutils ghostscript_headless gnused ]; @@ -126,7 +127,7 @@ in lib.recursiveUpdate orig rec { texlive-scripts.binlinks = { mktexfmt = "fmtutil"; - texhash = (lib.last tl."texlive.infra".pkgs) + "/bin/mktexlsr"; + texhash = tl."texlive.infra" + "/bin/mktexlsr"; }; texlive-scripts-extra.binlinks = { @@ -241,6 +242,10 @@ in lib.recursiveUpdate orig rec { sed -i '2i$ENV{PATH}='"'"'${lib.makeBinPath pst2pdf.extraBuildInputs}'"'"' . ($ENV{PATH} ? ":$ENV{PATH}" : '"'''"');' "$out"/bin/pst2pdf ''; + tex4ebook.postFixup = '' + sed -i '2ios.setenv("PATH","${lib.makeBinPath tex4ebook.extraBuildInputs}" .. (os.getenv("PATH") and ":" .. os.getenv("PATH") or ""))' "$out"/bin/tex4ebook + ''; + tex4ht.postFixup = '' sed -i -e '2iPATH="${lib.makeBinPath tex4ht.extraBuildInputs}''${PATH:+:$PATH}"' -e 's/\\rubyCall//g;' "$out"/bin/htcontext ''; @@ -352,7 +357,7 @@ in lib.recursiveUpdate orig rec { mkdir -p support/texdoc touch support/texdoc/NEWS - TEXMFCNF="${lib.head tl.kpathsea.pkgs}/web2c" TEXMF="$out" TEXDOCS=. TEXMFVAR=. \ + TEXMFCNF="${tl.kpathsea.tex}/web2c" TEXMF="$out" TEXDOCS=. TEXMFVAR=. \ "${bin.luatex}"/bin/texlua "$out"/scripts/texdoc/texdoc.tlu \ -c texlive_tlpdb=texlive.tlpdb -lM texdoc @@ -362,7 +367,7 @@ in lib.recursiveUpdate orig rec { # install zsh completion postFixup = '' - TEXMFCNF="${lib.head tl.kpathsea.pkgs}"/web2c TEXMF="$scriptsFolder/../.." \ + TEXMFCNF="${tl.kpathsea.tex}"/web2c TEXMF="$scriptsFolder/../.." \ texlua "$out"/bin/texdoc --print-completion zsh > "$TMPDIR"/_texdoc substituteInPlace "$TMPDIR"/_texdoc \ --replace 'compdef __texdoc texdoc' '#compdef texdoc' \ @@ -381,14 +386,14 @@ in lib.recursiveUpdate orig rec { license = [ "gpl2Plus" ] ++ lib.toList bin.core.meta.license.shortName ++ orig."texlive.infra".license or [ ]; scriptsFolder = "texlive"; - extraBuildInputs = [ coreutils gnused gnupg (lib.last tl.kpathsea.pkgs) (perl.withPackages (ps: with ps; [ Tk ])) ]; + extraBuildInputs = [ coreutils gnused gnupg tl.kpathsea (perl.withPackages (ps: with ps; [ Tk ])) ]; # make tlmgr believe it can use kpsewhich to evaluate TEXMFROOT postFixup = '' substituteInPlace "$out"/bin/tlmgr \ --replace 'if (-r "$bindir/$kpsewhichname")' 'if (1)' sed -i '2i$ENV{PATH}='"'"'${lib.makeBinPath [ gnupg ]}'"'"' . ($ENV{PATH} ? ":$ENV{PATH}" : '"'''"');' "$out"/bin/tlmgr - sed -i '2iPATH="${lib.makeBinPath [ coreutils gnused (lib.last tl.kpathsea.pkgs) ]}''${PATH:+:$PATH}"' "$out"/bin/mktexlsr + sed -i '2iPATH="${lib.makeBinPath [ coreutils gnused tl.kpathsea ]}''${PATH:+:$PATH}"' "$out"/bin/mktexlsr ''; # add minimal texlive.tlpdb diff --git a/pkgs/tools/typesetting/tex/texlive/tlpdb.nix b/pkgs/tools/typesetting/tex/texlive/tlpdb.nix index 87659160608..75501b60105 100644 --- a/pkgs/tools/typesetting/tex/texlive/tlpdb.nix +++ b/pkgs/tools/typesetting/tex/texlive/tlpdb.nix @@ -1707,6 +1707,7 @@ asymptote = { sha512.run = "4f97d0d87d1f29985c83c99629fc52e8e18f6eabf95d77aa888429187b49ed9525661d9c06b46a9b2295b03df412778ede1490fa9cd8ec680c3209a4ca6d0be0"; sha512.doc = "940297c3d69de7e01caa09ff44483f7334aba14705bdcdc83661ca9be2210133e094f99a8355b4b88d076355bb4f13f64c21700bff57f452dd5dbc8d2fddb432"; hasManpages = true; + hasInfo = true; hasRunfiles = true; license = [ "lgpl3" ]; version = "2.85"; @@ -15500,6 +15501,7 @@ dvipng = { sha512.run = "d24be610a63a9df22ebe6f53891519ab77900611d1159dec5e97b27160f3552b4cbce42b575a036125d2b15910a72cb5e3793a3409c5d0f4b1df0c2433e828f8"; sha512.doc = "976ff6c9628fe85adca2287f04d76f2c1605f243e28b4d32cb1ef9a90d30dcae0d202e6d5156914c204fd42b0a66460755a89f7dbdeb9ec1ccf6010cfe8daf78"; hasManpages = true; + hasInfo = true; license = [ "lgpl3" ]; version = "1.17"; }; @@ -15521,6 +15523,7 @@ dvips = { sha512.run = "a680a4685d3cbb429ad9dada0d48098f7755253ad1d7c808731f0f4fb4c37971cb937a9fa68bcecd892de93cc35a8086b742c86338460585c2912f36d00ade67"; sha512.doc = "a6acb780a45663fb21976622d7b6c3ea8d4adf1fe405ee97cd7c4cf09fa49b59069ba72b2aa14b53d3ba631b37c5cbd979929adaa274a0bec8b1272d85e1cd43"; hasManpages = true; + hasInfo = true; hasRunfiles = true; license = [ "free" ]; }; @@ -16610,6 +16613,7 @@ eplain = { sha512.run = "fda8158ae2bdc96187b6e6ace2a94be3e0f68201adbc02553b48a3848481352ac10ddd72babcbc2835e089ce751ade7dfa6cfd1c642c94155c2861db865f5c29"; sha512.doc = "60902b2422d2f5d7570a19daf7f586df7882505d7c156539699a0aa47a0f3bde5688dcbdc92c8a6a9878f11392bc9b9f147626aad230eecd2740d56f104928ed"; hasManpages = true; + hasInfo = true; sha512.source = "015de2eeeaec99bd15882a190f9ef3f2112520f8c591c7e6d2351c52d8690b024750adea426bcf95f438aaa20c97dd321881ac7212ff181e148337b57f6d386c"; hasRunfiles = true; license = [ "gpl2Plus" ]; @@ -16666,6 +16670,7 @@ epspdf = { revision = 66119; sha512.run = "f155834a9636991c8ae752f61f70bdf22ab3172270c85aebb05462cf26e44f6e81fb83842c8515bfa54e632a3beab8bb91cccf2b5eef459d77738443c77df56d"; sha512.doc = "5d06f8a4ef295e0fac8cd1dc73ff98e266dcf4394ed76223c92d20758fa8195ef5bea9bde49b1a247acfdf67aa7717092f978b55fc4fbc8665922487d57985d6"; + hasInfo = true; hasRunfiles = true; scriptExts = [ "tcl" @@ -18768,6 +18773,7 @@ fontname = { stripPrefix = 0; sha512.run = "424da4dbbc07c41840e6aeb6fabeef5d4778d206b9cb8a90e752ebeb65d962b96ad41a7e20c86a16665e2bf48ad795d85001da66ff41b01ae3c949c6eefa4593"; sha512.doc = "78199996913192f5f69423b6f412acc52b74f051b01d3e345b97b7f1d9ea4aea762a7b83488068f3091b41da69471d56b3f18ab4d299cc6adfe4e004072db303"; + hasInfo = true; hasRunfiles = true; license = [ "gpl1Only" ]; }; @@ -24499,6 +24505,7 @@ kpathsea = { sha512.run = "8a9f0dd49470bec5ba0f963a0385bea45141d6b805682bd65e95291b02158b9d2cedd5bd43592de7c447fe87f04efa00e4d1aa191a490147adcb57ec3922b5db"; sha512.doc = "51500943de0184fd9794dbf6af80aed2fc7bbaf2a7949facb1840ad0e32344d217aa4d58ee76e3934aec891858f789b3847b9027cb2bd75e5962be98ddd9d02f"; hasManpages = true; + hasInfo = true; hasRunfiles = true; license = [ "lgpl21" ]; }; @@ -25258,6 +25265,7 @@ latex2e-help-texinfo = { stripPrefix = 0; sha512.run = "34b91b19e1b71b1df6d0f57dda4d6976a93b16afac259656c9d4e331b0c23a9b0550563c1a10dd7a95640e3740b3b15597c1023f6c2721bf2a64800466b9cd09"; sha512.doc = "d4584d9259f3c1867e7445d4a219e4decc5ba3b305e20d1e780180a47fbad8df4d55552726d8288e78c8388823a2b652b81080c8139b00f4ea3ca10e5789375b"; + hasInfo = true; license = [ "free" ]; }; latex2e-help-texinfo-fr = { @@ -25265,6 +25273,7 @@ latex2e-help-texinfo-fr = { stripPrefix = 0; sha512.run = "96366ea420532f56ae076da48f5402c2ee78ca27fae8180795d6cd18aae118a8c7060208ff43ab64526addcdce9e4d90790583842b20c751f37865cf616e04e4"; sha512.doc = "52f6aea9ac2393a73d7dc7ce8ad4d6f08e0a224397199d5def97412502026717e8cb966552368899c50718a1049b1ad4610d2d23150a45bee55cc2c776003db7"; + hasInfo = true; license = [ "publicDomain" ]; }; latex2e-help-texinfo-spanish = { @@ -25272,6 +25281,7 @@ latex2e-help-texinfo-spanish = { stripPrefix = 0; sha512.run = "870c8f3af54ac42df5f4958669cf730cd16084c985f0b377c5aba9d526b8f7be14b367791d2c0a1f1a715739390ab63777ff2a92e7f9aad09897c8bbecff495e"; sha512.doc = "4c751a7305e089dab61bf991436ab1e612cfca0d17e416e21d659c04ef32eeb2d14dbeb09d63649a2b79f842766a218c43ae2c6fbeeba5549f039f991049a79d"; + hasInfo = true; license = [ "free" ]; }; latex2man = { @@ -25279,6 +25289,7 @@ latex2man = { sha512.run = "2617f6e8059f30c0098ea896cff69f585ea2ddbd3bbbd8066e7296dd833d3a246b8fefc0af71a92abf7e2051c754c0e3e6098175a4b181780563416bc9146b95"; sha512.doc = "390666cc56ad70342c9a24ca593fe65b3760674a882ed8bba383d193f2578285727a085f823afc03fa0dbc9966612caf9a29222fd2a9f39214f01aa268acdc50"; hasManpages = true; + hasInfo = true; hasRunfiles = true; license = [ "lppl1" ]; version = "1.29"; @@ -28873,6 +28884,7 @@ mf2pt1 = { revision = 61217; sha512.run = "ca93a3ae439f9cd8029720bd1d90fbe75a403e7ab4ebcbe1ba1e5a7a28aa9269197f90a4aee849fea59d734d5dc38f04eedc140ff1be64fd805a10ab5510a2f5"; sha512.doc = "6c10831fdcc48d25645be675fbf5da29da945bd79032c60e73e04a39d61c287a64e7b884381ac0b08e48f5dc9b6dec27efea874f6e13d6e4a5e3f32c22fa3ce2"; + hasInfo = true; hasRunfiles = true; license = [ "lppl13c" ]; version = "2.7"; @@ -40536,6 +40548,7 @@ tds = { stripPrefix = 0; sha512.run = "b03911aa9711eb5eeed77c026c4bbcf952da80322b855ac631e78c07a48ad2ff1a4afdd6e25a00257d1b70e054645f07f65c98fe74f6b1389be46625f5eb8487"; sha512.doc = "f4078e3b1693fedcbe139b67c50824845644a2b1e57dd27f9e46e44504d8fe8ac0ca706590e9149c06e71794a188b20777bfd6bf1afe85f16c806ba4f9b99cd8"; + hasInfo = true; license = [ "free" ]; version = "1.1"; }; @@ -41052,6 +41065,7 @@ texdraw = { stripPrefix = 0; sha512.run = "f4d160e494b1579743a83b2a0926df9e8dd69fdaa79d3f4f97e0ed5f4ece31ab380ff6994a1c9015e0af9b842bdfb9b066442ca4b3018df6659922af9f746b0b"; sha512.doc = "e177209a937fa1d9d683eb805e9e8929612b4b1ff750955d38ca681b657662712a59609990f77021063a223ce61a92fdd567eee91376ef4b67fd3a322db09463"; + hasInfo = true; hasRunfiles = true; license = [ "cc-by-40" ]; version = "v2r3"; @@ -41115,6 +41129,7 @@ texlive-en = { stripPrefix = 0; sha512.run = "f790f2a94e67573635afb5b4c2d375bede61eb3afe271169078fe905d326119234363ee896ecc93a9892d26e0a394fc350edbda810e218b0b06cc30681fd9cf0"; sha512.doc = "48ffb3b9053250f4425992c57869c6153601e9dfaa4931ac4ff3c12df44b148dce08496acbae495fd5f9fe37e11044a3fc0669c713515d2cc99506fd6be59859"; + hasInfo = true; }; texlive-es = { revision = 65640; |