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.
What is nix and why would I care? Well, that’s a long story but the headline benefits of nix are:
- reproducible builds (if it builds for me, it builds for you)
- stateless (you don’t set up switches and then install packages, each expression specifies everything it needs, and anything you don’t have is fetched/built on demand)
- language agnostic (takes care of non-ocaml dependencies)
It’s sadly not a shallow learning curve, but those benefits are hard to find elsewhere, so I obviously think it’s worthwhile. So if you use nix (or would like to), please give it a try and provide feedback. I’ll (slowly) start working on upstreaming it into nixpkgs.