I prepared a script to automate the process of installing OCaml and OPAM inside a Cloud9 IDE workspace. Enter into the terminal in any workspace:
The OCaml toolchain and OPAM are then ready to go. Here's a screenshot of compiling and running 'Hello, world!':
curl -L https://raw.github.com/mlin/c9-ocaml/master/c9-ocaml.sh | bash -ex eval $(opam config env)
OCaml syntax highlighting was already built-in, interestingly enough. A more elaborate example, where I used the site's GitHub integration to import ForkWork and ran the unit tests, which need OPAM packages like oasis and kaputt.
Some difficulties I encountered:
- The script builds the OCaml toolchain from source, which takes a solid 15-20 minutes for each new workspace.
- I couldn't immediately figure out a way to create binary packages due to some coincidental quirks: various OCaml binaries seem to be tied to the absolute installation path specified by their build configuration, while in Cloud9 IDE we can't write outside of the workspace home directory, the path of which is workspace-specific.
- Meanwhile there's some kind of nix-based package manager going on, but I couldn't find a way to extend it.
- Native-code camlp4 (make camlp4opt) doesn't successfully compile in the workspace; I'm not sure why, but perhaps it's the RAM ceiling. The c9-ocaml script jumps through some hoops to install the bytecode but not native-code version of camlp4, while installing both versions of the other tools.
Cloud9 IDE seems to have been originally designed for front-end and non-compiled back-end (Node.js, Rails, Django, etc.) development, and some typical IDE features for compiled languages are lacking. Improvement here is hopefully on their roadmap since it's touted by one of their competitors. That stated, the existing feature set is quite comparable to my lightweight Sublime/xterm flow.
I'd also like to see Cloud9 IDE provide an option to provision root access in a VM/cloud instance (as in Travis CI) or LXC container (as in Heroku, and here at DNAnexus), enabling full access to mainstream package repositories like apt. There appears to be an existing option in their premium tier where their back-end can ssh into some machine the user sets up herself, but it would be far more convenient to provide an elastic pool of VMs.