With dune, I see how to specify ‘opam global dependencies’ (i.e. stuff I install via
I see how to specify dependencies that are “in directory” i.e. sub directory of the
However, how do I specify a location that is out-of-directory, but not a opam package. I.e. I want to specify
I.e. I have ML code/libraries that I want to include that are (1) not part of an opam package and (2) not a subdirectory of
You can use opam pin for this.
This is actually a powerful mechanism to divert any package definition, and can even be used to locally create packages that don’t have entries in the repositories.
I use it to work with unpublished packages, local forks of published packages, etc.
We use a lots of git submodules in github.com/ocurrent. For the out of directory project you develop that with git and host it somewhere. Then in the top level project you want to consume it in you have a
dune file with
and you depend on it in your
*.opam file as normal
depends: [ "your_vendored_project" ]
Have a look at GitHub - ocurrent/ocaml-ci: A CI for OCaml projects it has many git submodules/ projects it pulls in.
I (incorrectly) thought
pin was only specifying a version; did not realize you could specify a location, and the location could be local. Thanks!
You can simply do either
dune install or
opam install . in the other project’s directory. It will install that project in your current opam switch (as if it was from a repository). It’s roughly equivalent to what you get with
opam pin – there was a discussion about the differences in this forum IIRC.