summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/hex
diff options
context:
space:
mode:
authorThéo Zimmermann <theo.zimmermann@univ-paris-diderot.fr>2018-11-05 11:21:46 +0100
committerThéo Zimmermann <theo.zimmermann@univ-paris-diderot.fr>2018-11-07 10:08:03 +0100
commit794158fcd54b862f3775bc8b54495a842a250b7b (patch)
tree333ef218a45bf9ca5d20186dc67bb9bd5209aca3 /pkgs/development/ocaml-modules/hex
parent5fc73fd52e7e9aa56911d152e3a5c49de8a18f61 (diff)
downloadnixpkgs-794158fcd54b862f3775bc8b54495a842a250b7b.tar
nixpkgs-794158fcd54b862f3775bc8b54495a842a250b7b.tar.gz
nixpkgs-794158fcd54b862f3775bc8b54495a842a250b7b.tar.bz2
nixpkgs-794158fcd54b862f3775bc8b54495a842a250b7b.tar.lz
nixpkgs-794158fcd54b862f3775bc8b54495a842a250b7b.tar.xz
nixpkgs-794158fcd54b862f3775bc8b54495a842a250b7b.tar.zst
nixpkgs-794158fcd54b862f3775bc8b54495a842a250b7b.zip
buildDunePackage: new support function; use it to refactor some OCaml derivations
Diffstat (limited to 'pkgs/development/ocaml-modules/hex')
-rw-r--r--pkgs/development/ocaml-modules/hex/default.nix21
1 files changed, 6 insertions, 15 deletions
diff --git a/pkgs/development/ocaml-modules/hex/default.nix b/pkgs/development/ocaml-modules/hex/default.nix
index 71a9ebf9ad5..0131b035970 100644
--- a/pkgs/development/ocaml-modules/hex/default.nix
+++ b/pkgs/development/ocaml-modules/hex/default.nix
@@ -1,34 +1,25 @@
-{ stdenv, fetchurl, ocaml, findlib, dune, cstruct }:
+{ stdenv, fetchurl, buildDunePackage, cstruct }:
 
-if !stdenv.lib.versionAtLeast ocaml.version "4.02"
-then throw "hex is not available for OCaml ${ocaml.version}"
-else
+buildDunePackage rec {
+  pname = "hex";
+  version = "1.2.0";
 
-let version = "1.2.0"; in
-
-stdenv.mkDerivation {
-  name = "ocaml${ocaml.version}-hex-${version}";
+  minimumOCamlVersion = "4.02";
 
   src = fetchurl {
-    url = "https://github.com/mirage/ocaml-hex/releases/download/v1.2.0/hex-1.2.0.tbz";
+    url = "https://github.com/mirage/ocaml-${pname}/releases/download/v${version}/hex-${version}.tbz";
     sha256 = "17hqf7z5afp2z2c55fk5myxkm7cm74259rqm94hcxkqlpdaqhm8h";
   };
 
   unpackCmd = "tar -xjf $curSrc";
 
-  buildInputs = [ ocaml findlib dune ];
   propagatedBuildInputs = [ cstruct ];
-
-  buildPhase = "dune build -p hex";
   doCheck = true;
-  checkPhase = "jbuilder runtest";
-  inherit (dune) installPhase;
 
   meta = {
     description = "Mininal OCaml library providing hexadecimal converters";
     homepage = https://github.com/mirage/ocaml-hex;
     license = stdenv.lib.licenses.isc;
     maintainers = with stdenv.lib.maintainers; [ vbgl ];
-    platforms = ocaml.meta.platforms or [];
   };
 }