summary refs log tree commit diff
path: root/pkgs/development/coq-modules
diff options
context:
space:
mode:
authorThéo Zimmermann <theo.zimmermann@inria.fr>2021-06-09 15:15:11 +0200
committerThéo Zimmermann <theo.zimmermann@inria.fr>2021-08-17 16:45:04 +0200
commit0c7e82e299a6dff270a279a47815da10bbcdb086 (patch)
treeeacc45f46e0b5f62afc552e58e3cf91f1ffbeefc /pkgs/development/coq-modules
parent26e1c41f93659fc9f12537e4c26112e09fcc9c48 (diff)
downloadnixpkgs-0c7e82e299a6dff270a279a47815da10bbcdb086.tar
nixpkgs-0c7e82e299a6dff270a279a47815da10bbcdb086.tar.gz
nixpkgs-0c7e82e299a6dff270a279a47815da10bbcdb086.tar.bz2
nixpkgs-0c7e82e299a6dff270a279a47815da10bbcdb086.tar.lz
nixpkgs-0c7e82e299a6dff270a279a47815da10bbcdb086.tar.xz
nixpkgs-0c7e82e299a6dff270a279a47815da10bbcdb086.tar.zst
nixpkgs-0c7e82e299a6dff270a279a47815da10bbcdb086.zip
coqPackages.serapi: init at multiple versions
Diffstat (limited to 'pkgs/development/coq-modules')
-rw-r--r--pkgs/development/coq-modules/serapi/default.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/development/coq-modules/serapi/default.nix b/pkgs/development/coq-modules/serapi/default.nix
new file mode 100644
index 00000000000..5505713eb47
--- /dev/null
+++ b/pkgs/development/coq-modules/serapi/default.nix
@@ -0,0 +1,72 @@
+{ lib, fetchzip, mkCoqDerivation, coq, version ? null }:
+
+let
+  ocamlPackages =
+    coq.ocamlPackages.overrideScope'
+      (self: super: {
+        ppxlib = super.ppxlib.override { version = "0.15.0"; };
+        # the following does not work
+        ppx_sexp_conv = super.ppx_sexp_conv.overrideAttrs (_: {
+          src = fetchzip {
+            url = "https://github.com/janestreet/ppx_sexp_conv/archive/v0.14.1.tar.gz";
+            sha256 = "04bx5id99clrgvkg122nx03zig1m7igg75piphhyx04w33shgkz2";
+          };
+        });
+      });
+
+  release = {
+    "8.13.0+0.13.0".sha256 = "sha256:0k69907xn4k61w4mkhwf8kh8drw9pijk9ynijsppihw98j8w38fy";
+    "8.12.0+0.12.1".sha256 = "sha256:048x3sgcq4h845hi6hm4j4dsfca8zfj70dm42w68n63qcm6xf9hn";
+    "8.11.0+0.11.1".sha256 = "sha256:1phmh99yqv71vlwklqgfxiq2vj99zrzxmryj2j4qvg5vav3y3y6c";
+    "8.10.0+0.7.2".sha256  = "sha256:1ljzm63hpd0ksvkyxcbh8rdf7p90vg91gb4h0zz0941v1zh40k8c";
+  };
+in
+
+(with lib; mkCoqDerivation rec {
+  pname = "serapi";
+  inherit version release;
+
+  defaultVersion =  with versions; switch coq.version [
+      { case = isEq "8.13"; out = "8.13.0+0.13.0"; }
+      { case = isEq "8.12"; out = "8.12.0+0.12.1"; }
+      { case = isEq "8.11"; out = "8.11.0+0.11.1"; }
+      { case = isEq "8.10"; out = "8.10.0+0.7.2";  }
+    ] null;
+
+  useDune2 = true;
+
+  propagatedBuildInputs =
+    with ocamlPackages; [
+      cmdliner
+      findlib # run time dependency of SerAPI
+      ppx_deriving
+      ppx_deriving_yojson
+      ppx_import
+      ppx_sexp_conv
+      sexplib
+      yojson
+      zarith # needed because of Coq
+    ];
+
+  installPhase = ''
+    runHook preInstall
+    dune install --prefix $out --libdir $OCAMLFIND_DESTDIR coq-serapi
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = https://github.com/ejgallego/coq-serapi;
+    description = "SerAPI is a library for machine-to-machine interaction with the Coq proof assistant";
+    license = licenses.lgpl21Plus;
+    maintainers = [ maintainers.Zimmi48 ];
+  };
+}).overrideAttrs(o:
+  let inherit (o) version; in {
+  src = fetchzip {
+    url = "https://github.com/ejgallego/coq-serapi/releases/download/${version}/coq-serapi-${
+        if version == "8.11.0+0.11.1" then version
+        else builtins.replaceStrings [ "+" ] [ "." ] version
+      }.tbz";
+    sha256 = release."${version}".sha256;
+  };
+})