at 23.05-pre 94 lines 2.9 kB view raw
1{ lib, fetchzip, mkCoqDerivation, coq, version ? null }: 2 3let 4 release = { 5 "8.16.0+0.16.0".sha256 = "sha256-Of5vO6wvqGyxagjGuuY3qCiLKbBr3VzLHiIn9U2R21E="; 6 "8.15.0+0.15.0".sha256 = "1vh99ya2dq6a8xl2jrilgs0rpj4j227qx8zvzd2v5xylx0p4bbrp"; 7 "8.14.0+0.14.0".sha256 = "1kh80yb791yl771qbqkvwhbhydfii23a7lql0jgifvllm2k8hd8d"; 8 "8.13.0+0.13.0".sha256 = "0k69907xn4k61w4mkhwf8kh8drw9pijk9ynijsppihw98j8w38fy"; 9 "8.12.0+0.12.1".sha256 = "048x3sgcq4h845hi6hm4j4dsfca8zfj70dm42w68n63qcm6xf9hn"; 10 "8.11.0+0.11.1".sha256 = "1phmh99yqv71vlwklqgfxiq2vj99zrzxmryj2j4qvg5vav3y3y6c"; 11 "8.10.0+0.7.2".sha256 = "1ljzm63hpd0ksvkyxcbh8rdf7p90vg91gb4h0zz0941v1zh40k8c"; 12 }; 13in 14 15(with lib; mkCoqDerivation rec { 16 pname = "serapi"; 17 inherit version release; 18 19 defaultVersion = with versions; 20 switch coq.version [ 21 { case = isEq "8.16"; out = "8.16.0+0.16.0"; } 22 { case = isEq "8.15"; out = "8.15.0+0.15.0"; } 23 { case = isEq "8.14"; out = "8.14.0+0.14.0"; } 24 { case = isEq "8.13"; out = "8.13.0+0.13.0"; } 25 { case = isEq "8.12"; out = "8.12.0+0.12.1"; } 26 { case = isEq "8.11"; out = "8.11.0+0.11.1"; } 27 { case = isEq "8.10"; out = "8.10.0+0.7.2"; } 28 ] null; 29 30 useDune = true; 31 32 patches = [ ./janestreet-0.15.patch ]; 33 34 propagatedBuildInputs = 35 with coq.ocamlPackages; [ 36 cmdliner 37 findlib # run time dependency of SerAPI 38 ppx_deriving 39 ppx_deriving_yojson 40 ppx_import 41 ppx_sexp_conv 42 sexplib 43 yojson 44 zarith # needed because of Coq 45 ]; 46 47 installPhase = '' 48 runHook preInstall 49 dune install --prefix $out --libdir $OCAMLFIND_DESTDIR coq-serapi 50 runHook postInstall 51 ''; 52 53 meta = with lib; { 54 homepage = "https://github.com/ejgallego/coq-serapi"; 55 description = "SerAPI is a library for machine-to-machine interaction with the Coq proof assistant"; 56 license = licenses.lgpl21Plus; 57 maintainers = [ maintainers.Zimmi48 ]; 58 }; 59}).overrideAttrs(o: 60 let inherit (o) version; in { 61 src = fetchzip { 62 url = 63 "https://github.com/ejgallego/coq-serapi/releases/download/${version}/coq-serapi-${ 64 if version == "8.11.0+0.11.1" then version 65 else builtins.replaceStrings [ "+" ] [ "." ] version 66 }.tbz"; 67 sha256 = release."${version}".sha256; 68 }; 69 70 patches = 71 if version == "8.10.0+0.7.2" 72 then [ 73 ./8.10.0+0.7.2.patch 74 ] 75 else if version == "8.11.0+0.11.1" 76 then [ 77 ./8.11.0+0.11.1.patch 78 ] 79 else if version == "8.12.0+0.12.1" || version == "8.13.0+0.13.0" 80 then [ 81 ./8.12.0+0.12.1.patch 82 ] 83 else if version == "8.14.0+0.14.0" || version == "8.15.0+0.15.0" 84 then [ 85 ./janestreet-0.15.patch 86 ] 87 else [ 88 ]; 89 90 propagatedBuildInputs = o.propagatedBuildInputs ++ 91 lib.optional (version == "8.16.0+0.16.0" || version == "dev") coq.ocamlPackages.ppx_hash 92 ; 93 94})