Hi, I’m trying to set up Ocaml to work with the Real World Ocaml book.
I can’t seem to get utop to detect installed libraries. Here’s my default.nix file so far:
with import <nixpkgs> {};
let
ocamlPackages = pkgs.recurseIntoAttrs pkgs.ocamlPackages_latest;
findlibSiteLib = "${ocamlPackages.findlib}/lib/ocaml/${ocamlVersion}/site-lib";
ocamlVersion = (builtins.parseDrvName ocamlPackages.ocaml.name).version;
ocamlInit = pkgs.writeText "ocamlinit" ''
let () =
try Topdirs.dir_directory "${findlibSiteLib}"
with Not_found -> ()
;;
#use "topfind";;
#thread;;
#require "base";;
#require "core.top";;
#require "core.syntax";;
'';
in
stdenv.mkDerivation rec {
name = "rwo-shell";
buildInputs = with ocamlPackages; [
ocaml
core
core_extended
base
utop
findlib
];
shellHook = ''
alias utop = "utop -init ${ocamlInit}""
'';
}
- run
utop
- run
open Base;;
- Get error:
Error: Unbound module Base
Am I missing something here?