nix-env -i opamopam init[ERROR] Missing dependencies -- the following commands are required for OPAM to operate:
- unzip
It doesn't seem possible to do anything useful with opam without unzip installed.
I have a stupid question (this is not to troll nor to say that what you report is not an issue): why do you want to or need to use opam as a package manager when you already use nix?
So, I'm new to nix and haven't looked too deeply at the ocaml support, but nixpkgs seems to only contain a small subset of the packages on OPAM, and a lot of what does exist looks out of date (for example, menhir is at 20140422 while OPAM has 11 releases listed since then). And then trying to install a popular package like core gives me an error on 16.03:
$ nix-env -iA nixos.ocamlPackages.core
error: assertion failed at /nix/store/j4l0lpl690vj9q6xa63hlcs6hnn56x7q-nixos-16.03.503.3f96280/nixos/pkgs/build-support/ocaml/default.nix:17:3
It seems like just getting the packages used in Real World Ocaml installed w/ nix would involve a lot of hacking and writing/updating nix expressions versus a single opam install command.
About the failing assertion and the old version of menhir, the problem is that the default version of ocaml on nixos is still 4.01 -- don't know why, it maybe worth submitting a PR about this -- which is too old for core and the recent versions of menhir.
So nixos.ocamlPackages_4_02.core and nixos.ocamlPackages_4_02.menhir are working and more up-to-date.
(And for the original issue, It suppose it makes sense to add unzip as a runtime dependency, but it seems to me that there are a few other ones -- at least ocaml itself and probably curl too -- that are also required).
A runtime dependency on ocaml isn't necessary if your use case is to let opam itself compile and manage your ocaml, e.g.:
$ nix-shell --pure -p gnumake gcc unzip curl opam
$ opam init --comp=4.04.0+trunk
$ eval `opam config env`
$ ocaml -version
The OCaml toplevel, version 4.04.0+dev0-2016-02-18
works fine. Either curl or wget is always necessary, however.
@micxjo could you open a PR instead? I'm generally in favor of being somewhat conservative about adding run-time dependencies, but it makes sense if the program truly cannot operate without it.
@micxjo: Also, here's an example of a default.nix for use with nix-shell that I have used for _Real World OCaml_:
https://gist.github.com/henrytill/7c1831b31d7780e64a2d53120aee13a1