Skip to content

Instantly share code, notes, and snippets.

@archaeron
Created March 5, 2018 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archaeron/1114565ab9823b412fe1d24dd82d6975 to your computer and use it in GitHub Desktop.
Save archaeron/1114565ab9823b412fe1d24dd82d6975 to your computer and use it in GitHub Desktop.
Ocaml Nix
with import <nixpkgs> {};
let
ocamlPackages = pkgs.recurseIntoAttrs pkgs.ocamlPackages_4_03;
ocamlVersion = (builtins.parseDrvName ocamlPackages.ocaml.name).version;
findlibSiteLib = "${ocamlPackages.findlib}/lib/ocaml/${ocamlVersion}/site-lib";
ocamlInit = pkgs.writeText "ocamlinit" ''
let () =
try Topdirs.dir_directory "${findlibSiteLib}"
with Not_found -> ()
;;
#use "topfind";;
#thread;;
#camlp4o;;
#require "core";;
#require "core.syntax";;
'';
in
stdenv.mkDerivation rec {
name = "rwo-shell";
src = null;
buildInputs = with ocamlPackages;
[ ocaml
camlp4
core
core_extended
findlib
merlin
base
utop
];
# CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRAkRY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/";
UTOP_SITE_LISP = "${ocamlPackages.utop}/share/emacs/site-lisp";
OCAMLINIT = "${ocamlInit}";
shellHook = ''
alias utop="utop -init ${ocamlInit}"
alias ocaml="ocaml -init ${ocamlInit}"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment