Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 ocaml, 6 pkg-config, 7 solo5, 8 target ? "xen", 9}: 10 11# note: this is not technically an ocaml-module, 12# but can be built with different compilers, so 13# the ocamlPackages set is very useful. 14 15let 16 pname = "ocaml-freestanding"; 17in 18 19if lib.versionOlder ocaml.version "4.08" then 20 builtins.throw "${pname} is not available for OCaml ${ocaml.version}" 21else 22 23 stdenv.mkDerivation rec { 24 name = "ocaml${ocaml.version}-${pname}-${version}"; 25 inherit pname; 26 version = "0.6.5"; 27 28 src = fetchFromGitHub { 29 owner = "mirage"; 30 repo = pname; 31 rev = "v${version}"; 32 sha256 = "sha256:1mbyjzwcs64n7i3xkkyaxgl3r46drbl0gkqf3fqgm2kh3q03638l"; 33 }; 34 35 postUnpack = '' 36 # get ocaml-src from the ocaml drv instead of via ocamlfind 37 mkdir -p "${src.name}/ocaml" 38 tar --strip-components=1 -xf ${ocaml.src} -C "${src.name}/ocaml" 39 ''; 40 41 patches = [ 42 ./no-opam.patch 43 ./configurable-binding.patch 44 ]; 45 46 strictDeps = true; 47 48 nativeBuildInputs = [ 49 ocaml 50 pkg-config 51 ]; 52 53 propagatedBuildInputs = [ solo5 ]; 54 55 configurePhase = '' 56 runHook preConfigure 57 env PKG_CONFIG_DEPS=solo5-bindings-${target} sh configure.sh 58 runHook postConfigure 59 ''; 60 61 installPhase = '' 62 runHook preInstall 63 ./install.sh "$out" 64 runHook postInstall 65 ''; 66 67 meta = with lib; { 68 broken = true; # Not compatible with solo5 ≥ 0.7 69 description = "Freestanding OCaml runtime"; 70 license = licenses.mit; 71 maintainers = [ maintainers.sternenseemann ]; 72 homepage = "https://github.com/mirage/ocaml-freestanding"; 73 platforms = builtins.map ({ arch, os }: "${arch}-${os}") ( 74 cartesianProduct { 75 arch = [ 76 "aarch64" 77 "x86_64" 78 ]; 79 os = [ "linux" ]; 80 } 81 ++ [ 82 { 83 arch = "x86_64"; 84 os = "freebsd"; 85 } 86 { 87 arch = "x86_64"; 88 os = "openbsd"; 89 } 90 ] 91 ); 92 }; 93 }