Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

texlive: switch to buildEnv/withPackages #250243

Open
15 of 23 tasks
xworld21 opened this issue Aug 19, 2023 · 0 comments
Open
15 of 23 tasks

texlive: switch to buildEnv/withPackages #250243

xworld21 opened this issue Aug 19, 2023 · 0 comments
Labels
0.kind: enhancement Add something new 6.topic: TeX Issues regarding texlive and TeX in general
Milestone

Comments

@xworld21
Copy link
Contributor

xworld21 commented Aug 19, 2023

This is to track various changes to modernize texlive and make it work like haskell, lua, perl, python, which seem to have converged on the same interface. This comes after quite a lot of work to make the existing texlive almost 100% functional and with lots of tests, so we should be able to spot breakages easily. That's the theory anyway.

Feedback and comments are very welcome. Cc @veprbl @apfelkuchen6.

Intended outcome

Building a new TeX Live environment:

texlive.withPackages (ps: with ps; [ scheme-small dvipng ])

Building a TeX Live environment with documentation or a different paper size:

# replace arguments of buildEnv
texlive.buildEnv.override { packages = ps: with ps; [ scheme-small ]; extraOutputsToInstall = [ "texdoc" ]; }
# extend arguments of buildEnv (e.g. add packages)
texlive.scheme-small.buildEnv { extraOutputsToInstall = [ "texdoc" ]; paperSize = "letter"; }

Building a TeX Live package outside of texlive

stdenv.mkDerivation { outputs = [ "out" "tex" ]; ... }

Replace a TeX Live package with a different version, or pass other overrides

texlive.scheme-small.override { packageOverrides = final: prev: { asymptote = asymptote; }; }

The changes will also make it easier to ship different snapshots of TeX Live, or at least to upgrade/downgrade locally, and to package tlcontrib. We should also become able to deduplicate the formats.

Roadmap

Here is a tentative roadmap. I believe we have enough of the difficult parts in draft form to make it by 23.11, and be prepared to drop the old stuff in 24.05/24.11, so that we make a single big change. We should really try to do this once: I already made a mistake this cycle when introducing tlDeps, which in hindsight was the wrong choice (see requiredTeXPackages below)!

Still, each step should be fully backward compatible, so we can stop halfway if we don't make it.

Internals (no rebuild, fully backward compatible, new interface undocumented and prefixed with _)

  1. Procure more tests! tests.texlive: several new tests #248960 for start, plus texlive: fix tlmgr, tlshell, licenses #247798 to fix tests.texlive.licenses.
  2. Refactor the packages outside of texlive (fix texlive.combine: package 'combine' from CTAN not usable #237227). Edit: new scope postponed as it takes more thinking than I expected.
  3. Use a 'multi-output' approach for TeX Live packages. Proof-of-concept in [WIP] texlive: change TeX Live packages into attribute sets instead of lists #249803: not literally multi-output, packages are still groups of fixed output derivations that build independently of each other.
    • Rewrite buildTeXLivePackage accordingly (ready in texlive: multi-output packages (subset of #250805) #250963).
    • Backward compatibility: provide 'alias' texlivePackages.example.pkgs with old tlType interface, set texlive.example = { inherit (texlivePackages.example) pkgs; }. Edit: maybe there won't be a texlivePackages.
  4. Implement texlive._buildEnv and shorthand texlive._withPackages.

Switch on new interface

  1. Enable .withPackages.

Next release cycle?

  1. Make the TeX Live packages overrideable.
    • Decide a stable interface for buildTeXLivePackage, decoupled from the quirks of tlpdb.nix as much as possible.
    • Expose overrideTeXLiveAttrs.
  2. Create a properly spliced scope for texlive; it must be possible to override binaries and packages simultaneously in a consistent way, and supporting cross compiling as far as possible (buildEnv cannot be cross compiled, unfortunately). Discussion in progress at texlive: create scope #250416 and texlive: transform into overridable scope and extract generic interface #250626.
  3. Deprecate .combine.

By deprecation, I mean add a deprecation notice with lib.warn and use config.allowedAliases to prevent usage within Nixpkgs.

Ideal scenario, we merge everything by the end of September, to have a good period of testing before 23.11.

@xworld21 xworld21 added 0.kind: enhancement Add something new 6.topic: TeX Issues regarding texlive and TeX in general labels Aug 19, 2023
@veprbl veprbl added this to the 23.11 milestone Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement Add something new 6.topic: TeX Issues regarding texlive and TeX in general
Projects
None yet
Development

No branches or pull requests

2 participants