texlive.withPackages: move withDocs, withSources from passthru to derivation arguments

This commit is contained in:
Vincenzo Mantova
2026-05-23 13:50:51 +01:00
parent 62b7051f28
commit 41d265c82a
2 changed files with 24 additions and 23 deletions
+3 -5
View File
@@ -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}
@@ -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: