New TeX Live withPackages function

It works!

# recursively remove all dependencies matching (x: x.pname == pname) from pkg.tlDeps
rmDeps = pkg: pname:
  if pkg ? tlDeps && pkg.tlDeps != [] then
    pkg // { tlDeps = map (x: rmDeps x pname) (pkgs.lib.filter (x: x.pname != pname) pkg.tlDeps); }
  else
    pkg;
scheme = rmDeps (builtins.elemAt pkgs.texlive.scheme-full.pkgs 0) "minted";
...
buildInputs = [ (pkgs.texlive.withPackages (_: [ scheme minted3 ])) ];

I cannot figure out yet how to make this new version of minted work, but that’s another story. Thank you so much for your help. Cheers

A tip: you can use texlive.pkgs.scheme-full instead of builtins.elemAt. The scheme-full.pkgs attribute is a legacy of the old texlive.combine and will be deprecated too, eventually.

@Hippwn would you be able to test texlive.withPackages: relax dependency resolution by xworld21 · Pull Request #321750 · NixOS/nixpkgs · GitHub? I did not have a test package at hand, so I did not check if the following actually works:

texliveFull.withPackages (_: [ minted3 ])