Loading pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix +119 −90 Original line number Diff line number Diff line { lib , fetchurl , runCommand , writeShellScript # script interpreters , bash Loading @@ -18,6 +19,16 @@ /* 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" ] The multi-output is emulated as follows: - the main derivation is a multi-output derivation that builds links to the containers (tex, texdoc, ...) - the output attributes are replaced with the actual containers with the outputSpecified attribute set to true In this way, when texlive.withPackages picks an output such as drv.tex, it receives the actual container, avoiding superfluous dependencies on the other containers (for instance doc containers). */ # TODO stabilise a generic interface decoupled from the finer details of the Loading Loading @@ -50,47 +61,43 @@ let license = map (x: lib.licenses.${x}) license; # TeX Live packages should not be installed directly into the user profile outputsToInstall = [ ]; longDescription = '' This package cannot be installed directly. Please use `texlive.withPackages`. ''; } // lib.optionalAttrs (args ? shortdesc) { description = args.shortdesc; }; 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) # containers that will be built by Hydra outputs = lib.optional hasBinfiles "out" ++ lib.optional hasRunfiles "tex" ++ lib.optional hasDocfiles "texdoc" ++ # omit building sources, since as far as we know, installing them is not common # the sources will still be available under drv.texsource # lib.optional hasSource "texsource" ++ lib.optional hasTlpkg "tlpkg" ++ lib.optional hasManpages "man" ++ lib.optional hasInfo "info"; outputDrvs = lib.getAttrs outputs containers; passthru = { inherit all outputs pname; # metadata inherit pname; revision = toString revision + extraRevision; version = version + extraVersion; # containers behave like specified outputs outputSpecified = true; inherit tex; } // lib.optionalAttrs (args ? deps) { tlDeps = args.deps; } // lib.optionalAttrs (args ? fontMaps) { inherit (args) fontMaps; } // lib.optionalAttrs (args ? formats) { inherit (args) formats; } // lib.optionalAttrs (args ? hyphenPatterns) { inherit (args) hyphenPatterns; } // 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; }; // lib.optionalAttrs hasSource { inherit (containers) texsource; } // lib.optionalAttrs (! hasRunfiles) { tex = fakeTeX; }; # build run, doc, source, tlpkg containers mkContainer = tlType: tlOutputName: sha512: Loading Loading @@ -125,24 +132,12 @@ let fi '' + postUnpack); in # remove the standard drv.out, optionally replace it with the bin container builtins.removeAttrs container [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; # remove drv.out to avoid confusing texlive.withPackages removeAttrs container [ "out" ] // outputDrvs; 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 extToInput = { jar = jdk; lua = texliveBinaries.luatex; py = python3; Loading @@ -153,20 +148,34 @@ let tlu = texliveBinaries.luatex; }; bin = runCommand "${name}" # fake derivation for resolving dependencies in the absence of a "tex" containers fakeTeX = passthru // { inherit meta; tlOutputName = "tex"; } // outputDrvs; containers = rec { tex = mkContainer "run" "tex" sha512.run; texdoc = mkContainer "doc" "texdoc" sha512.doc; texsource = mkContainer "source" "texsource" sha512.source; tlpkg = mkContainer "tlpkg" "tlpkg" sha512.run; # bin container out = runCommand "${name}" { inherit meta; passthru = passthru // { tlOutputName = "out"; }; # shebang interpreters buildInputs = let outName = builtins.replaceStrings [ "-" ] [ "_" ] pname; in [ texliveBinaries.core.${outName} or null [ texliveBinaries.core.${outName} or null texliveBinaries.${pname} or null texliveBinaries.core-big.${outName} 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.optionals (tex ? outPath) (builtins.map (f: tex.outPath + "/scripts/" + f) (lib.toList args.scriptsFolder or pname)); scriptsFolder = lib.optionals (hasRunfiles && tex ? outPath) (map (f: tex.outPath + "/scripts/" + f) (lib.toList args.scriptsFolder or pname)); # binaries info inherit (args) binfiles; binlinks = builtins.attrNames (args.binlinks or { }); Loading @@ -178,10 +187,11 @@ let '' . "$makeBinContainers" ${args.postFixup or ""} ''; '' // outputDrvs; # build man, info containers man = builtins.removeAttrs (runCommand "${name}-man" man = removeAttrs (runCommand "${name}-man" { inherit meta texdoc; passthru = passthru // { tlOutputName = "man"; }; Loading @@ -189,9 +199,10 @@ let '' mkdir -p "$out"/share ln -s {"$texdoc"/doc,"$out"/share}/man '') [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; '') [ "out" ] // outputDrvs; info = builtins.removeAttrs (runCommand "${name}-info" info = removeAttrs (runCommand "${name}-info" { inherit meta texdoc; passthru = passthru // { tlOutputName = "info"; }; Loading @@ -199,6 +210,24 @@ let '' mkdir -p "$out"/share ln -s {"$texdoc"/doc,"$out"/share}/info '') [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; '') [ "out" ] // outputDrvs; }; in builtins.removeAttrs mainDrv [ "outputSpecified" ] if outputs == [ ] then removeAttrs fakeTeX [ "outputSpecified" ] else runCommand name { __structuredAttrs = true; inherit meta outputDrvs outputs; passthru = removeAttrs passthru [ "outputSpecified" ]; # force output name in case "out" is missing nativeBuildInputs = lib.optional (! hasBinfiles) (writeShellScript "force-output.sh" '' export out="''${${builtins.head outputs}-}" ''); } '' for outputName in ''${!outputs[@]} ; do ln -s "''${outputDrvs[$outputName]}" "''${outputs[$outputName]}" done '' // outputDrvs pkgs/tools/typesetting/tex/texlive/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ let fixedHashes = lib.optionalAttrs useFixedHashes (import ./fixed-hashes.nix); buildTeXLivePackage = import ./build-texlive-package.nix { inherit lib fetchurl runCommand bash jdk perl python3 ruby snobol4 tk; inherit lib fetchurl runCommand writeShellScript bash jdk perl python3 ruby snobol4 tk; texliveBinaries = bin; }; Loading pkgs/tools/typesetting/tex/texlive/tl2nix.sed +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,12 @@ $a} # extract revision s/^revision ([0-9]*)$/ revision = \1;/p # extract short description /^shortdesc (.+)$/{ s/"/\\"/g # escape quotes s/^shortdesc (.+)/ shortdesc = "\1";/p } # extract hashes of *.tar.xz s/^containerchecksum (.*)/ sha512.run = "\1";/p s/^doccontainerchecksum (.*)/ sha512.doc = "\1";/p Loading pkgs/tools/typesetting/tex/texlive/tlpdb-overrides.nix +5 −5 Original line number Diff line number Diff line Loading @@ -131,10 +131,10 @@ in lib.recursiveUpdate orig rec { # TODO: handle symlinks in bin.core ptex.binlinks = { pbibtex = tl.uptex + "/bin/upbibtex"; pdvitype = tl.uptex + "/bin/updvitype"; ppltotf = tl.uptex + "/bin/uppltotf"; ptftopl = tl.uptex + "/bin/uptftopl"; pbibtex = tl.uptex.out + "/bin/upbibtex"; pdvitype = tl.uptex.out + "/bin/updvitype"; ppltotf = tl.uptex.out + "/bin/uppltotf"; ptftopl = tl.uptex.out + "/bin/uptftopl"; }; texdef.binlinks = { Loading @@ -143,7 +143,7 @@ in lib.recursiveUpdate orig rec { texlive-scripts.binlinks = { mktexfmt = "fmtutil"; texhash = tl."texlive.infra" + "/bin/mktexlsr"; texhash = tl."texlive.infra".out + "/bin/mktexlsr"; }; texlive-scripts-extra.binlinks = { Loading pkgs/tools/typesetting/tex/texlive/tlpdb.nix +4443 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix +119 −90 Original line number Diff line number Diff line { lib , fetchurl , runCommand , writeShellScript # script interpreters , bash Loading @@ -18,6 +19,16 @@ /* 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" ] The multi-output is emulated as follows: - the main derivation is a multi-output derivation that builds links to the containers (tex, texdoc, ...) - the output attributes are replaced with the actual containers with the outputSpecified attribute set to true In this way, when texlive.withPackages picks an output such as drv.tex, it receives the actual container, avoiding superfluous dependencies on the other containers (for instance doc containers). */ # TODO stabilise a generic interface decoupled from the finer details of the Loading Loading @@ -50,47 +61,43 @@ let license = map (x: lib.licenses.${x}) license; # TeX Live packages should not be installed directly into the user profile outputsToInstall = [ ]; longDescription = '' This package cannot be installed directly. Please use `texlive.withPackages`. ''; } // lib.optionalAttrs (args ? shortdesc) { description = args.shortdesc; }; 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) # containers that will be built by Hydra outputs = lib.optional hasBinfiles "out" ++ lib.optional hasRunfiles "tex" ++ lib.optional hasDocfiles "texdoc" ++ # omit building sources, since as far as we know, installing them is not common # the sources will still be available under drv.texsource # lib.optional hasSource "texsource" ++ lib.optional hasTlpkg "tlpkg" ++ lib.optional hasManpages "man" ++ lib.optional hasInfo "info"; outputDrvs = lib.getAttrs outputs containers; passthru = { inherit all outputs pname; # metadata inherit pname; revision = toString revision + extraRevision; version = version + extraVersion; # containers behave like specified outputs outputSpecified = true; inherit tex; } // lib.optionalAttrs (args ? deps) { tlDeps = args.deps; } // lib.optionalAttrs (args ? fontMaps) { inherit (args) fontMaps; } // lib.optionalAttrs (args ? formats) { inherit (args) formats; } // lib.optionalAttrs (args ? hyphenPatterns) { inherit (args) hyphenPatterns; } // 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; }; // lib.optionalAttrs hasSource { inherit (containers) texsource; } // lib.optionalAttrs (! hasRunfiles) { tex = fakeTeX; }; # build run, doc, source, tlpkg containers mkContainer = tlType: tlOutputName: sha512: Loading Loading @@ -125,24 +132,12 @@ let fi '' + postUnpack); in # remove the standard drv.out, optionally replace it with the bin container builtins.removeAttrs container [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; # remove drv.out to avoid confusing texlive.withPackages removeAttrs container [ "out" ] // outputDrvs; 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 extToInput = { jar = jdk; lua = texliveBinaries.luatex; py = python3; Loading @@ -153,20 +148,34 @@ let tlu = texliveBinaries.luatex; }; bin = runCommand "${name}" # fake derivation for resolving dependencies in the absence of a "tex" containers fakeTeX = passthru // { inherit meta; tlOutputName = "tex"; } // outputDrvs; containers = rec { tex = mkContainer "run" "tex" sha512.run; texdoc = mkContainer "doc" "texdoc" sha512.doc; texsource = mkContainer "source" "texsource" sha512.source; tlpkg = mkContainer "tlpkg" "tlpkg" sha512.run; # bin container out = runCommand "${name}" { inherit meta; passthru = passthru // { tlOutputName = "out"; }; # shebang interpreters buildInputs = let outName = builtins.replaceStrings [ "-" ] [ "_" ] pname; in [ texliveBinaries.core.${outName} or null [ texliveBinaries.core.${outName} or null texliveBinaries.${pname} or null texliveBinaries.core-big.${outName} 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.optionals (tex ? outPath) (builtins.map (f: tex.outPath + "/scripts/" + f) (lib.toList args.scriptsFolder or pname)); scriptsFolder = lib.optionals (hasRunfiles && tex ? outPath) (map (f: tex.outPath + "/scripts/" + f) (lib.toList args.scriptsFolder or pname)); # binaries info inherit (args) binfiles; binlinks = builtins.attrNames (args.binlinks or { }); Loading @@ -178,10 +187,11 @@ let '' . "$makeBinContainers" ${args.postFixup or ""} ''; '' // outputDrvs; # build man, info containers man = builtins.removeAttrs (runCommand "${name}-man" man = removeAttrs (runCommand "${name}-man" { inherit meta texdoc; passthru = passthru // { tlOutputName = "man"; }; Loading @@ -189,9 +199,10 @@ let '' mkdir -p "$out"/share ln -s {"$texdoc"/doc,"$out"/share}/man '') [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; '') [ "out" ] // outputDrvs; info = builtins.removeAttrs (runCommand "${name}-info" info = removeAttrs (runCommand "${name}-info" { inherit meta texdoc; passthru = passthru // { tlOutputName = "info"; }; Loading @@ -199,6 +210,24 @@ let '' mkdir -p "$out"/share ln -s {"$texdoc"/doc,"$out"/share}/info '') [ "out" ] // lib.optionalAttrs hasBinfiles { out = bin; }; '') [ "out" ] // outputDrvs; }; in builtins.removeAttrs mainDrv [ "outputSpecified" ] if outputs == [ ] then removeAttrs fakeTeX [ "outputSpecified" ] else runCommand name { __structuredAttrs = true; inherit meta outputDrvs outputs; passthru = removeAttrs passthru [ "outputSpecified" ]; # force output name in case "out" is missing nativeBuildInputs = lib.optional (! hasBinfiles) (writeShellScript "force-output.sh" '' export out="''${${builtins.head outputs}-}" ''); } '' for outputName in ''${!outputs[@]} ; do ln -s "''${outputDrvs[$outputName]}" "''${outputs[$outputName]}" done '' // outputDrvs
pkgs/tools/typesetting/tex/texlive/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ let fixedHashes = lib.optionalAttrs useFixedHashes (import ./fixed-hashes.nix); buildTeXLivePackage = import ./build-texlive-package.nix { inherit lib fetchurl runCommand bash jdk perl python3 ruby snobol4 tk; inherit lib fetchurl runCommand writeShellScript bash jdk perl python3 ruby snobol4 tk; texliveBinaries = bin; }; Loading
pkgs/tools/typesetting/tex/texlive/tl2nix.sed +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,12 @@ $a} # extract revision s/^revision ([0-9]*)$/ revision = \1;/p # extract short description /^shortdesc (.+)$/{ s/"/\\"/g # escape quotes s/^shortdesc (.+)/ shortdesc = "\1";/p } # extract hashes of *.tar.xz s/^containerchecksum (.*)/ sha512.run = "\1";/p s/^doccontainerchecksum (.*)/ sha512.doc = "\1";/p Loading
pkgs/tools/typesetting/tex/texlive/tlpdb-overrides.nix +5 −5 Original line number Diff line number Diff line Loading @@ -131,10 +131,10 @@ in lib.recursiveUpdate orig rec { # TODO: handle symlinks in bin.core ptex.binlinks = { pbibtex = tl.uptex + "/bin/upbibtex"; pdvitype = tl.uptex + "/bin/updvitype"; ppltotf = tl.uptex + "/bin/uppltotf"; ptftopl = tl.uptex + "/bin/uptftopl"; pbibtex = tl.uptex.out + "/bin/upbibtex"; pdvitype = tl.uptex.out + "/bin/updvitype"; ppltotf = tl.uptex.out + "/bin/uppltotf"; ptftopl = tl.uptex.out + "/bin/uptftopl"; }; texdef.binlinks = { Loading @@ -143,7 +143,7 @@ in lib.recursiveUpdate orig rec { texlive-scripts.binlinks = { mktexfmt = "fmtutil"; texhash = tl."texlive.infra" + "/bin/mktexlsr"; texhash = tl."texlive.infra".out + "/bin/mktexlsr"; }; texlive-scripts-extra.binlinks = { Loading
pkgs/tools/typesetting/tex/texlive/tlpdb.nix +4443 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes