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