If COQ_USE_DUNE is set, then the opam installation of coq will try to use dune and end up not installing anything.
Steps to reproduce:
export COQ_USE_DUNE=true
opam switch create test 4.12.0
opam update
opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq -vv # observe dune is being used and an error is produced
Cf. rocq-prover/rocq#14469 and the zulip discussion.