How to override an input of rocmPackages? (to workaround another py312 related nixpkgs regression)

While updating my system (nixos-unstable) I was bit by yet another python3 -> python-3.12 regression:

       > ModuleNotFoundError: No module named 'distutils'
       >
       > FAILED: CMakeFiles/check-runtimes /build/source/runtimes/build/CMakeFiles/check-runtimes
       > cd /build/source/runtimes/build && /nix/store/z7xxy35k7620hs6fn6la5fg2lgklv72l-python3-3.12.4/bin/python3.12 /nix/store/yz7yczcfpipg2gdbs5xm9pxxl84h1pq7-python3.12-lit-18.1.7/bin/.lit-wrapped -sv --show-xfail --show-unsupported /build/source/runtimes/build/compiler-rt/test/builtins/TestCases /build/source/runtimes/build/compiler-rt/test/builtins/Unit/X86_64LinuxConfig
       > ninja: build stopped: subcommand failed.
       For full logs, run 'nix log /nix/store/x0cc4afsyk5m2ly5lhg2mycwqbg2zarb-rocm-llvm-compiler-rt-6.0.2.drv'.

So I went and looked in Nix Package Search and found the rocm base module derivation for all attributes under rocmPackages. Assuming that this would mean that the input in that base.nix is consequently used for all its “child derivations”, I added to my overlays

      rocmPackages = prev.rocmPackages.override {python3Packages = prev.python311.pkgs;};

but this didn’t have any effect, same with rocmPackages = prev.rocmPackages // { llvm.compiler-rt = prev.rocmPackages.llvm.compiler-rt.override {python3Packages = prev.python311.pkgs;};};

So how to do such an override to make sure for all under rocmPackages python-3.11 is used?

The topic of overriding (members of) package sets has been a recurring PITA for me traditionally, any clear/concise/correct references explaining this in more general terms?