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