First of all: Did you do apt dist-upgrade as well? If I remember correctly that is a new required step when upgrading to a new Debian release.
If that doesn’t help, you could check if your nvidia-detect package version is the expected version, that comes with Debian 12.
If neither of these steps help you could disregard nvidia-detect and try the steps listed in the following link. It seems the firmware was moved to a separate repository compared to Debian 11. You might need to add that by hand. wiki.debian.org/NvidiaGraphicsDrivers#bookworm-52…
Imho I wouldn’t bother with nix-env or nix profile. It just creates a secondary list of packages that needs to be maintained and it’s cumbersome to do so. There’s nix-shell or nix shell if you need a package temporarily and there’s your configuration.nix or flake for everything else.
Side note: nix profile at least has consistent commands: install/remove/upgrade