texlivePackages: use proper multioutput derivations

TeX Live packages under `texlivePackages` are now left as simple
multioutput derivations (without changes done in `passthru`). This
should ensure that all outputs are copied in the binary caches.

(cherry picked from commit 637c1c82bf)
This commit is contained in:
Vincenzo Mantova 2024-05-12 19:00:07 +01:00 committed by github-actions[bot]
parent 45343c299d
commit 637e8d887c
2 changed files with 29 additions and 20 deletions

View File

@ -62,7 +62,7 @@ let
# TeX Live packages should not be installed directly into the user profile
outputsToInstall = [ ];
longDescription = ''
This package cannot be installed directly. Please use `texlive.withPackages`.
This package cannot be installed or used directly. Please use `texlive.withPackages (ps: [ ps.${lib.strings.escapeNixIdentifier pname} ])`.
'';
# discourage nix-env from matching this package
priority = 10;
@ -152,7 +152,7 @@ let
# fake derivation for resolving dependencies in the absence of a "tex" containers
fakeTeX = passthru
// { inherit meta; tlOutputName = "tex"; }
// { inherit meta; tlOutputName = "tex"; inherit build; }
// outputDrvs;
containers = rec {
@ -214,22 +214,31 @@ let
ln -s {"$texdoc"/doc,"$out"/share}/info
'') [ "out" ] // outputDrvs;
};
in
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" ''
# multioutput derivation to be exported under texlivePackages
# to make Hydra build all containers
build = runCommand name
{
__structuredAttrs = true;
inherit meta outputDrvs;
outputs = if outputs != [ ] then outputs else [ "out" ];
passthru = removeAttrs passthru [ "outputSpecified" ] // { inherit build; };
# force output name in case "out" is missing
preHook = lib.optionalString (!hasBinfiles && outputs != [ ]) ''
export out="''${${builtins.head outputs}-}"
'');
}
''
for outputName in ''${!outputs[@]} ; do
ln -s "''${outputDrvs[$outputName]}" "''${outputs[$outputName]}"
done
'' // outputDrvs
'';
}
# each output is just a symlink to the corresponding container
# if the container is missing (that is, outputs == [ ]), create a file, to prevent passing the package to .withPackages
''
for outputName in ''${!outputs[@]} ; do
if [[ -z ''${outputDrvs[$outputName]} ]] ; then
ln -s "''${outputDrvs[$outputName]}" "''${outputs[$outputName]}"
else
touch "''${outputs[$outputName]}"
fi
done
'';
in
if outputs == [ ] then removeAttrs fakeTeX [ "outputSpecified" ] else build // outputDrvs

View File

@ -5278,7 +5278,7 @@ with pkgs;
# TeX Live; see https://nixos.org/nixpkgs/manual/#sec-language-texlive
texlive = callPackage ../tools/typesetting/tex/texlive { };
inherit (texlive.schemes) texliveBasic texliveBookPub texliveConTeXt texliveFull texliveGUST texliveInfraOnly texliveMedium texliveMinimal texliveSmall texliveTeTeX;
texlivePackages = recurseIntoAttrs (lib.filterAttrs (_: lib.isDerivation) texlive.pkgs);
texlivePackages = recurseIntoAttrs (lib.mapAttrs (_: v: v.build) texlive.pkgs);
fop = callPackage ../tools/typesetting/fop { };