about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/coq-modules/coqprime/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/coq-modules/coqprime/default.nix')
-rw-r--r--nixpkgs/pkgs/development/coq-modules/coqprime/default.nix77
1 files changed, 23 insertions, 54 deletions
diff --git a/nixpkgs/pkgs/development/coq-modules/coqprime/default.nix b/nixpkgs/pkgs/development/coq-modules/coqprime/default.nix
index f16341ddbd1b..79db14610758 100644
--- a/nixpkgs/pkgs/development/coq-modules/coqprime/default.nix
+++ b/nixpkgs/pkgs/development/coq-modules/coqprime/default.nix
@@ -1,60 +1,29 @@
-{ stdenv, which, fetchFromGitHub, coq, bignums }:
-
-let
-  params =
-    let v_8_8 = {
-          version = "8.8";
-          sha256 = "075yjczk79pf1hd3lgdjiz84ilkzfxjh18lgzrhhqp7d3kz5lxp5";
-        };
-        v_8_10 = {
-          version = "8.10";
-          sha256 = "0r9gnh5a5ykiiz5h1i8xnzgiydpwc4z9qhndxyya85xq0f910qaz";
-        };
-    in
-      {
-        "8.7" = {
-          version = "8.7.2";
-          sha256 = "15zlcrx06qqxjy3nhh22wzy0rb4npc8l4nx2bbsfsvrisbq1qb7k";
-        };
-        "8.8" = v_8_8;
-        "8.9" = v_8_8;
-        "8.10" = v_8_10;
-        "8.11" = v_8_10;
-	"8.12" = {
-	  version = "8.12";
-          sha256 = "1slka4w0pya15js4drx9frj7lxyp3k2lzib8v23givzpnxs8ijdj";
-	};
-      };
-  param = params.${coq.coq-version};
-in
-
-stdenv.mkDerivation rec {
-
-  inherit (param) version;
-  name = "coq${coq.coq-version}-coqprime-${version}";
-
-  src = fetchFromGitHub {
-    owner = "thery";
-    repo = "coqprime";
-    rev = "v${version}";
-    inherit (param) sha256;
-  };
-
-  buildInputs = [ which coq ];
-
+{ which, lib, mkCoqDerivation, coq, bignums, version ? null }:
+
+with lib; mkCoqDerivation {
+
+  pname = "coqprime";
+  owner = "thery";
+  inherit version;
+  defaultVersion = with versions; switch coq.coq-version [
+    { case = "8.12";              out = "8.12"; }
+    { case = range "8.10" "8.11"; out = "8.10"; }
+    { case = range "8.8"  "8.9";  out = "8.8"; }
+    { case = "8.7";               out = "8.7.2"; }
+  ] null;
+
+  release."8.12".sha256  = "1slka4w0pya15js4drx9frj7lxyp3k2lzib8v23givzpnxs8ijdj";
+  release."8.10".sha256  = "0r9gnh5a5ykiiz5h1i8xnzgiydpwc4z9qhndxyya85xq0f910qaz";
+  release."8.8".sha256   = "075yjczk79pf1hd3lgdjiz84ilkzfxjh18lgzrhhqp7d3kz5lxp5";
+  release."8.7.2".sha256 = "15zlcrx06qqxjy3nhh22wzy0rb4npc8l4nx2bbsfsvrisbq1qb7k";
+  releaseRev = v: "v${v}";
+
+  extraBuildInputs = [ which ];
   propagatedBuildInputs = [ bignums ];
 
-  installFlags = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ];
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library to certify primality using Pocklington certificate and Elliptic Curve Certificate";
     license = licenses.lgpl21;
-    maintainers = [ stdenv.lib.maintainers.vbgl ];
-    inherit (coq.meta) platforms;
-    inherit (src.meta) homepage;
-  };
-
-  passthru = {
-    compatibleCoqVersions = v: builtins.hasAttr v params;
+    maintainers = [ maintainers.vbgl ];
   };
 }