add nix ocaml setup
This commit is contained in:
		
							parent
							
								
									a76296a6be
								
							
						
					
					
						commit
						fd80679cc3
					
				
					 1 changed files with 33 additions and 0 deletions
				
			
		
							
								
								
									
										33
									
								
								default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
with import <nixpkgs> {};
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
  ocamlPackages = pkgs.recurseIntoAttrs pkgs.ocamlPackages_latest;
 | 
			
		||||
  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;;
 | 
			
		||||
    #require "core";;
 | 
			
		||||
    #require "core.syntax";;
 | 
			
		||||
  '';
 | 
			
		||||
in
 | 
			
		||||
stdenv.mkDerivation rec {
 | 
			
		||||
  name = "rwo-shell";
 | 
			
		||||
  src = null;
 | 
			
		||||
  buildInputs = with ocamlPackages;
 | 
			
		||||
    [ ocaml
 | 
			
		||||
      core
 | 
			
		||||
      core_extended
 | 
			
		||||
      findlib
 | 
			
		||||
      utop
 | 
			
		||||
    ];
 | 
			
		||||
  shellHook = ''
 | 
			
		||||
    alias utop="utop -init ${ocamlInit}"
 | 
			
		||||
    alias ocaml="ocaml -init ${ocamlInit}"
 | 
			
		||||
  '';
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue