Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 ocaml, 6 findlib, 7 ocamlbuild, 8 camlp4, 9}: 10 11let 12 pname = "ulex"; 13 param = 14 if lib.versionAtLeast ocaml.version "4.02" then 15 { 16 version = "1.2"; 17 sha256 = "08yf2x9a52l2y4savjqfjd2xy4pjd1rpla2ylrr9qrz1drpfw4ic"; 18 } 19 else 20 { 21 version = "1.1"; 22 sha256 = "0cmscxcmcxhlshh4jd0lzw5ffzns12x3bj7h27smbc8waxkwffhl"; 23 }; 24in 25 26lib.throwIf (lib.versionAtLeast ocaml.version "5.0") 27 "ulex is not available for OCaml ${ocaml.version}" 28 29 stdenv.mkDerivation 30 rec { 31 name = "ocaml${ocaml.version}-${pname}-${version}"; 32 inherit (param) version; 33 34 src = fetchFromGitHub { 35 owner = "whitequark"; 36 repo = pname; 37 rev = "v${version}"; 38 inherit (param) sha256; 39 }; 40 41 createFindlibDestdir = true; 42 43 nativeBuildInputs = [ 44 ocaml 45 findlib 46 ocamlbuild 47 camlp4 48 ]; 49 propagatedBuildInputs = [ camlp4 ]; 50 51 strictDeps = true; 52 53 buildFlags = [ 54 "all" 55 "all.opt" 56 ]; 57 58 meta = { 59 inherit (src.meta) homepage; 60 description = "Lexer generator for Unicode and OCaml"; 61 license = lib.licenses.mit; 62 inherit (ocaml.meta) platforms; 63 maintainers = [ lib.maintainers.roconnor ]; 64 }; 65 }