summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml
diff options
context:
space:
mode:
authorThéo Zimmermann <theo.zimmermann@univ-paris-diderot.fr>2018-10-22 12:03:33 +0200
committerVincent Laporte <vbgl@users.noreply.github.com>2018-10-23 14:22:59 +0000
commitcea4806bc5c425d2f9d9e110ae425b010e870662 (patch)
tree07a8b22a457895793991eca22487e84e79e99ef8 /pkgs/development/tools/ocaml
parenta463643de88ec09fed4a5f9ad77fe3a6410d13b0 (diff)
downloadnixlib-cea4806bc5c425d2f9d9e110ae425b010e870662.tar
nixlib-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.gz
nixlib-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.bz2
nixlib-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.lz
nixlib-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.xz
nixlib-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.zst
nixlib-cea4806bc5c425d2f9d9e110ae425b010e870662.zip
ocamlformat: init at 0.8
Diffstat (limited to 'pkgs/development/tools/ocaml')
-rw-r--r--pkgs/development/tools/ocaml/ocamlformat/default.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/development/tools/ocaml/ocamlformat/default.nix b/pkgs/development/tools/ocaml/ocamlformat/default.nix
new file mode 100644
index 000000000000..e0b744c83593
--- /dev/null
+++ b/pkgs/development/tools/ocaml/ocamlformat/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchFromGitHub, ocamlPackages, dune }:
+
+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";
+  pname = "ocamlformat";
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "ocaml-ppx";
+    repo = pname;
+    rev = version;
+    sha256 = "1i7rsbs00p43362yv7z7dw0qsnv7vjf630qk676qvfg7kg422w6j";
+  };
+
+  buildInputs = [
+    ocaml
+    dune
+    findlib
+    base
+    cmdliner
+    fpath
+    ocaml-migrate-parsetree
+    stdio
+  ];
+
+  configurePhase = ''
+    patchShebangs tools/gen_version.sh
+    tools/gen_version.sh src/Version.ml version
+  '';
+
+  buildPhase = ''
+    dune build -p ocamlformat
+  '';
+
+  inherit (dune) installPhase;
+
+  meta = {
+    homepage = "https://github.com/ocaml-ppx/ocamlformat";
+    description = "Auto-formatter for OCaml code";
+    maintainers = [ stdenv.lib.maintainers.Zimmi48 ];
+    license = stdenv.lib.licenses.mit;
+    inherit (ocamlPackages.ocaml.meta) platforms;
+  };
+}