Made overly elaborate example of a ‘Hello World’ package with Nix flakes, OCaml, and Dune: github.com/brendanzab/oca
Disclaimer: I'm a beginner at Nix and I've never really used OCaml or Dune before so if you know these, please tell me if I am doing anything silly. 🥴
Conversation
Interesting, how does the dune promote step locate the test results (that I assume nix flake test (should that read `check`?) put somewhere in the Nix store)?
1
Replying to
You need to run `dune promote` in an impure dev shell, which means it will build the stuff separately, alas. Not sure if it's possible to package that up nicer.
Oh yeah, that's a typo, should be `nix flake check`!
Updated the wording, with a link to the dune docs regarding "promotion". It's pretty nifty this stuff comes bundled with dune - I've had to do a bunch of work to set this up for Rust in the past. But yeah kind of goes against the isolation that nix affords, perhaps?
1
Yeah, sometimes one has to get "creative" to adapt impure workflows. See the very end of leanprover.github.io/lean4/doc/dev/ for how I do it with Lean, it's not ~too~ bad.
1

