summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml/ocamlformat/default.nix
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/tools/ocaml/ocamlformat/default.nix
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/tools/ocaml/ocamlformat/default.nix')
-rw-r--r--pkgs/development/tools/ocaml/ocamlformat/default.nix27
1 files changed, 6 insertions, 21 deletions
diff --git a/pkgs/development/tools/ocaml/ocamlformat/default.nix b/pkgs/development/tools/ocaml/ocamlformat/default.nix
index e0b744c8359..694f4b6e89a 100644
--- a/pkgs/development/tools/ocaml/ocamlformat/default.nix
+++ b/pkgs/development/tools/ocaml/ocamlformat/default.nix
@@ -1,15 +1,10 @@
-{ stdenv, fetchFromGitHub, ocamlPackages, dune }:
+{ stdenv, fetchFromGitHub, ocamlPackages }:
 
-with ocamlPackages;
-
-if !stdenv.lib.versionAtLeast ocaml.version "4.05"
-then throw "ocamlformat is not available for OCaml ${ocaml.version}"
-else
-
-stdenv.mkDerivation rec {
-  version = "0.8";
+with ocamlPackages; buildDunePackage rec {
   pname = "ocamlformat";
-  name = "${pname}-${version}";
+  version = "0.8";
+
+  minimumOCamlVersion = "4.05";
 
   src = fetchFromGitHub {
     owner = "ocaml-ppx";
@@ -19,9 +14,6 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [
-    ocaml
-    dune
-    findlib
     base
     cmdliner
     fpath
@@ -34,17 +26,10 @@ stdenv.mkDerivation rec {
     tools/gen_version.sh src/Version.ml version
   '';
 
-  buildPhase = ''
-    dune build -p ocamlformat
-  '';
-
-  inherit (dune) installPhase;
-
   meta = {
-    homepage = "https://github.com/ocaml-ppx/ocamlformat";
+    inherit (src.meta) homepage;
     description = "Auto-formatter for OCaml code";
     maintainers = [ stdenv.lib.maintainers.Zimmi48 ];
     license = stdenv.lib.licenses.mit;
-    inherit (ocamlPackages.ocaml.meta) platforms;
   };
 }