Dune, OxCaml and locking dependencies

Running dune in verbose mode I see that it’s not using the OxCaml opam repo

❯ dune pkg lock --verbose
Shared cache: enabled-except-user-rules
Shared cache location: /Users/joelr/.cache/dune/db
Workspace root: /Users/joelr/Work/OCaml/habu
Auto-detected concurrency: 12
Running[4]: (cd /Users/joelr/.cache/dune/git-repo && /usr/bin/git ls-remote https://github.com/ocaml-dune/opam-overlays.git) > /var/folders/b5/r1rvht6j2mxflh71xgl6vr8m0000gn/T/dune_289313_output
Running[5]: (cd /Users/joelr/.cache/dune/git-repo && /usr/bin/git ls-remote https://github.com/ocaml/opam-repository.git) > /var/folders/b5/r1rvht6j2mxflh71xgl6vr8m0000gn/T/dune_9fdbd9_output

unlike opam which does

❯ opam repo list
[NOTE] These are the repositories in use by the current switch. Use '--all' to see all
       configured repositories.

<><> Repository configuration for switch 5.2.0+ox <><><><><><><><><><><><><>  🐫
 1 ox      git+https://github.com/oxcaml/opam-repository.git
 2 default https://opam.ocaml.org

Adding the repos to dune-workspace does the trick, though

(lang dune 3.17)

(lock_dir
 (repositories ox upstream overlay))

(repository
 (name ox)
 (url "git+https://github.com/oxcaml/opam-repository.git"))

Dune docs mention that the default repo should be available as :default and include both upstream and overlay. I get an undefined keyword error when I use that, though. I filed a Github issue, maybe the docs need to be updated.

2 Likes