"register" Nix installed OCaml in OPAM?

Hi,

I’ve been trying to integrate Nix installed OCaml compiler with OPAM, but:

  1. opam install only works when current switch is properly set up, with packages like ocaml-base-compiler / ocaml-config installed (which are missing from Nix).

  2. opam switch cannot “adopt” existing OCaml installation. Even if I can work around it with some symlink hacks, opam install may fail because it needs to write to $OCAML_PREFIX/lib (but paths in Nix store are read-only).

Is there any better workflow that does not require installing OCaml with OPAM?