Using config.replaceStdenv
or $pkg.override { stdenv = $aoccStdEnv; }
might work but you need to define this aoccStdEnv
with working aocc compilers.
I have done this years ago in nur-packages/overlays/aocc-overlay/default.nix at 708b38fe80fcd8a2529316f5cd1edf5c163209b7 · dguibert/nur-packages · GitHub.
There are also overlays for other compilers: intel-compilers, nvhpc, …
Some of some need to be updated to support newer versions or newer installer.
Feel free to give a try (and made a PR).