From 41d265c82a41c0582b27bb746d1fd9205dc6a750 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Sat, 16 May 2026 18:14:05 +0100 Subject: [PATCH] texlive.withPackages: move withDocs, withSources from passthru to derivation arguments --- doc/languages-frameworks/texlive.section.md | 8 ++-- .../typesetting/tex/texlive/build-tex-env.nix | 39 ++++++++++--------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/doc/languages-frameworks/texlive.section.md b/doc/languages-frameworks/texlive.section.md index b3305e259044..9822cfca0347 100644 --- a/doc/languages-frameworks/texlive.section.md +++ b/doc/languages-frameworks/texlive.section.md @@ -42,13 +42,11 @@ Release 23.11 ships with a new interface that will eventually replace `texlive.c ``` Note that the packages in `texlive.pkgs` are only provided for search purposes and must not be used directly. -- **Experimental and subject to change without notice:** to add the documentation for all packages in the environment, use +- To add the documentation for all packages in the environment, use ```nix - texliveSmall.__overrideTeXConfig { withDocs = true; } + texliveSmall.overrideAttrs { withDocs = true; } ``` - This can be applied before or after calling `withPackages`. - - The function currently supports the parameters `withDocs`, `withSources`, and `requireTeXPackages`. + This can be applied before or after calling `withPackages`. The parameter `withSources` adds all source containers. ## User's guide {#sec-language-texlive-user-guide} diff --git a/pkgs/tools/typesetting/tex/texlive/build-tex-env.nix b/pkgs/tools/typesetting/tex/texlive/build-tex-env.nix index bfc196dd0d8d..35fcf111a44a 100644 --- a/pkgs/tools/typesetting/tex/texlive/build-tex-env.nix +++ b/pkgs/tools/typesetting/tex/texlive/build-tex-env.nix @@ -40,8 +40,8 @@ lib.fix ( finalAttrs: let - withDocs = finalAttrs.passthru.withDocs or false; - withSources = finalAttrs.passthru.withSources or false; + withDocs = finalAttrs.withDocs or false; + withSources = finalAttrs.withSources or false; # 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; @@ -317,8 +317,6 @@ lib.fix ( let # arguments of buildTeXEnv before deprecation of __overrideTeXConfig prevArgs = { - withDocs = finalAttrs.passthru.withDocs or false; - withSources = finalAttrs.passthru.withSources or false; inherit (finalAttrs) __combine ; @@ -328,22 +326,27 @@ lib.fix ( __extraVersion __fromCombineWrapper ; - }; + } + // lib.optionalAttrs (finalAttrs ? withDocs) { inherit (finalAttrs) withDocs; } + // lib.optionalAttrs (finalAttrs ? withSources) { inherit (finalAttrs) withSources; }; appliedArgs = prevArgs // (if builtins.isFunction newArgs then newArgs prevArgs else newArgs); in - finalAttrs.finalPackage.overrideAttrs (prevAttrs: { - passthru = prevAttrs.passthru // { - inherit (appliedArgs) - withDocs - withSources - requiredTeXPackages - __extraName - __extraVersion - ; - __fromCombineWrapper = false; - }; - inherit (appliedArgs) __combine; - }) + finalAttrs.finalPackage.overrideAttrs ( + prevAttrs: + { + passthru = prevAttrs.passthru // { + inherit (appliedArgs) + requiredTeXPackages + __extraName + __extraVersion + ; + __fromCombineWrapper = false; + }; + inherit (appliedArgs) __combine; + } + // lib.optionalAttrs (appliedArgs ? withDocs) { inherit (appliedArgs) withDocs; } + // lib.optionalAttrs (appliedArgs ? withSources) { inherit (appliedArgs) withSources; } + ) ); withPackages = reqs: