Hello, I would like to install some OCaml libraries globally, so that they are always available without creating a nix-shell.
environment.systemPackages = with pkgs; [
] ++ (with pkgs.ocaml-ng.ocamlPackages_5_1; [
utop findlib base core
configuration.nix, but I get
No such package: base from
utop when I try to
I think the issue is that
OCAMLPATH is not set, how can I fix this?
Even if you set
OCAMLPATH correctly, the linker that nixpkgs provides does not work outside of
nix develop). It may find the libc, but not other c libraries that you could depend on, like gmp for zarith. You can hack around this, but in the end you will probably fight longer against nix than the benefit you may get from nix.
Instead, I suggest you consider how you could make the nix-shell workflow be more acceptable. For example I recommend you use direnv (either with builtin direnv support, or nix-direnv, or lorri). When you
cd into the directory of a project, you automatically enter nix-shell. Most editors also have direnv plugins that make the editor take nix-shell into account when you open a file into a project. The cost is a one-time setup per project. If the .envrc file is annoying because you don’t want to impose it to collaborators by committing it to the git repository, you can add it to
Thank you, I was thinking mostly about quick REPLs to experiment with something, rather than full projects, but I guess I can make a shell alias for that.