Stack new: error: attribute 'ghc' missing

Then you most likely need to update your Nix channels, as GHC 9.5.2 was released relatively recently and subsequently added to nixpkgs.

The stack documentation I linked describes how to set a specific NIX_PATH just for the specific stack project, which allows you to pin a certain nixpkgs revision. Switching the resolver is as easy as changing a configuration value in stack.yaml.

Note that the latter doesn’t really apply to you, as you are using an apparently up to date resolver. People usually run into the opposite case that a GHC they need has been dropped from nixpkgs since it is quite outdated already.

Depends on what you mean by reproducibility – it is not magic after all.

The stack Nix integration (which we did not even write) can not feasably ensure that you have the package definitions available for any given GHC version. And we can’t package GHC 9.2.5 before it is released, so an outdated channel of course doesn’t include this version of the compiler.