about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/coq-modules/category-theory/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/coq-modules/category-theory/default.nix')
-rw-r--r--nixpkgs/pkgs/development/coq-modules/category-theory/default.nix58
1 files changed, 15 insertions, 43 deletions
diff --git a/nixpkgs/pkgs/development/coq-modules/category-theory/default.nix b/nixpkgs/pkgs/development/coq-modules/category-theory/default.nix
index 1178b1558ff7..339bcb9d6b09 100644
--- a/nixpkgs/pkgs/development/coq-modules/category-theory/default.nix
+++ b/nixpkgs/pkgs/development/coq-modules/category-theory/default.nix
@@ -1,54 +1,26 @@
-{ stdenv, fetchgit, coq, ssreflect, equations }:
+{ lib, mkCoqDerivation, coq, ssreflect, equations, version ? null }:
 
-let
-  params =
-    let
-    v20180709 = {
-      version = "20180709";
-      rev = "3b9ba7b26a64d49a55e8b6ccea570a7f32c11ead";
-      sha256 = "0f2nr8dgn1ab7hr7jrdmr1zla9g9h8216q4yf4wnff9qkln8sbbs";
-    };
-    v20190414 = {
-      version = "20190414";
-      rev = "706fdb4065cc2302d92ac2bce62cb59713253119";
-      sha256 = "16lg4xs2wzbdbsn148xiacgl4wq4xwfqjnjkdhfr3w0qh1s81hay";
-    };
-  in {
-    "8.6" = v20180709;
-    "8.7" = v20180709;
-    "8.8" = v20190414;
-    "8.9" = v20190414;
-  };
-  param = params.${coq.coq-version};
-in
+with lib; mkCoqDerivation {
 
-stdenv.mkDerivation {
+  pname = "category-theory";
+  owner = "jwiegley";
 
-  name = "coq${coq.coq-version}-category-theory-${param.version}";
+  release."20190414".rev    = "706fdb4065cc2302d92ac2bce62cb59713253119";
+  release."20190414".sha256 = "16lg4xs2wzbdbsn148xiacgl4wq4xwfqjnjkdhfr3w0qh1s81hay";
+  release."20180709".rev    = "3b9ba7b26a64d49a55e8b6ccea570a7f32c11ead";
+  release."20180709".sha256 = "0f2nr8dgn1ab7hr7jrdmr1zla9g9h8216q4yf4wnff9qkln8sbbs";
 
-  src = fetchgit {
-    url = "git://github.com/jwiegley/category-theory.git";
-    inherit (param) rev sha256;
-  };
+  inherit version;
+  defaultVersion = with versions; switch coq.coq-version [
+    { case = range "8.8" "8.9"; out = "20190414"; }
+    { case = range "8.6" "8.7"; out = "20180709"; }
+  ] null;
 
-  buildInputs = [ coq ] ++ (with coq.ocamlPackages; [ ocaml camlp5 findlib ]);
+  mlPlugin = true;
   propagatedBuildInputs = [ ssreflect equations ];
 
-  buildFlags = [ "JOBS=$(NIX_BUILD_CORES)" ];
-
-  installPhase = ''
-    make -f Makefile.coq COQLIB=$out/lib/coq/${coq.coq-version}/ install
-  '';
-
-  meta = with stdenv.lib; {
-    homepage = "https://github.com/jwiegley/category-theory";
+  meta = {
     description = "A formalization of category theory in Coq for personal study and practical work";
     maintainers = with maintainers; [ jwiegley ];
-    platforms = coq.meta.platforms;
   };
-
-  passthru = {
-    compatibleCoqVersions = v: builtins.hasAttr v params;
-  };
-
 }