Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, camlp4, menhir 2, menhirLib, yojson, ulex, pprint, fix, functory 3}: 4 5if lib.versionAtLeast ocaml.version "4.06" 6then throw "mezzo is not available for OCaml ${ocaml.version}" 7else 8 9let 10 check-ocaml-version = with lib; versionAtLeast (getVersion ocaml); 11in 12 13assert check-ocaml-version "4"; 14 15stdenv.mkDerivation { 16 17 pname = "mezzo"; 18 version = "0.0.m8"; 19 20 src = fetchFromGitHub { 21 owner = "protz"; 22 repo = "mezzo"; 23 rev = "m8"; 24 sha256 = "0yck5r6di0935s3iy2mm9538jkf77ssr789qb06ms7sivd7g3ip6"; 25 }; 26 27 strictDeps = true; 28 29 nativeBuildInputs = [ ocaml findlib ocamlbuild camlp4 menhir ]; 30 buildInputs = [ yojson menhirLib ulex pprint fix functory ocamlbuild ]; 31 32 # Sets warning 3 as non-fatal 33 prePatch = lib.optionalString (check-ocaml-version "4.02") '' 34 substituteInPlace myocamlbuild.pre.ml \ 35 --replace '@1..3' '@1..2+3' 36 '' 37 # Compatibility with PPrint ≥ 20220103 38 + '' 39 substituteInPlace typing/Fact.ml --replace PPrintOCaml PPrint.OCaml 40 ''; 41 42 createFindlibDestdir = true; 43 44 postInstall = '' 45 mkdir $out/bin 46 cp mezzo $out/bin/ 47 ''; 48 49 meta = with lib; { 50 homepage = "http://protz.github.io/mezzo/"; 51 description = "A programming language in the ML tradition, which places strong emphasis on the control of aliasing and access to mutable memory"; 52 license = licenses.gpl2; 53 platforms = ocaml.meta.platforms or []; 54 }; 55} 56 57