I am one of these people. I mostly rely on Nix, whose package repository nixpkgs provides package sets for all (relatively recent) versions of OCaml. These package sets are not generally as complete as what you can find on opam, so it sometimes happens that I open a PR on the nixpkgs repository to add a new package (and in the meantime I use my local updated copy of the nixpkgs repo).
You can see the list of available OCaml packages at: https://nixos.org/nixos/packages.html?channel=nixpkgs-unstable&query=ocamlPackages
(This is for the default OCaml version, currently 4.07 in nixpkgs-unstable. Other package sets are called
ocaml-ng.ocamlPackages_4_0X but are not shown in this web search.)
Most OCaml packages are available at a single version in nixpkgs (even though you can choose your version of OCaml). To gain more flexibility on the exact version I use in one of my project, I am planning to test Duniverse. At that point, I would rely on Duniverse for library dependencies, but I would still rely on Nix to install OCaml, findlib, Dune, Duniverse (I’ll have to take care of packaging it), utop, merlin, or ocamlformat.
Nix is pretty straightforward to use. You generally provide a
default.nix at the root of your repository, and it will list the dependencies that you use. When you want to go develop your project, you just enter a special shell (with the
nix-shell command) and you are in an environment where the tools you need are in
PATH and the libraries you need are in
There’s just one tool that I needed special configuration for:
ocamlformat (especially because some projects use it and some do not). When I use it, my
shellHook = ''
which will export an environment variable when I enter the shell.
(setq ocamlformat-location (getenv "OCAMLFORMAT_LOCATION"))
(when (> (length ocamlformat-location) 0)
(add-to-list 'load-path (concat ocamlformat-location "/share/emacs/site-lisp"))
(lambda () (add-hook 'before-save-hook 'ocamlformat-before-save))))
If you mean as a library author, then all you have to ensure is that you use Dune as the build system (makes the Duniverse workflow better, and makes it easier to package your library in nixpkgs, cf.
buildDunePackage documented at https://nixos.org/nixpkgs/manual/#sec-language-ocaml).