Anouncing opam2nix (v1)
You run an (impure) command to resolve all transitive dependency versions using the current opam repository, generating a .nix file that locks down the exact package sources and versions. Then this file can be imported to provide
buildInputs for building your ocaml project in nix.
If you’ve used opam2nix v0 (which has actually been around for a few years), it worked a little differently. In v0 the entire universe of available packages was generated as .nix files, and it would resolve your dependencies purely at build time. This was convenient and allowed for some low-friction use cases, but made for quite a complex and confusing nix API, and required a frequently-updated generated packageset. The new v1 will be much more straightforward to integrate into nixpkgs itself, as updates are only required when the tool itself changes.
So if you use ocaml / opam, please give it a try and provide feedback. I’ll (slowly) start working on upstreaming it into nixpkgs.