summary refs log tree commit diff
path: root/pkgs
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
parenta463643de88ec09fed4a5f9ad77fe3a6410d13b0 (diff)
downloadnixpkgs-cea4806bc5c425d2f9d9e110ae425b010e870662.tar
nixpkgs-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.gz
nixpkgs-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.bz2
nixpkgs-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.lz
nixpkgs-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.xz
nixpkgs-cea4806bc5c425d2f9d9e110ae425b010e870662.tar.zst
nixpkgs-cea4806bc5c425d2f9d9e110ae425b010e870662.zip
ocamlformat: init at 0.8
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/ocaml/ocamlformat/default.nix50
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 52 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 00000000000..e0b744c8359
--- /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;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 70c4050d588..b44edc0a4e7 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7266,6 +7266,8 @@ with pkgs;
 
   ocamlPackages = recurseIntoAttrs ocaml-ng.ocamlPackages;
 
+  ocamlformat = callPackage ../development/tools/ocaml/ocamlformat { };
+
   orc = callPackage ../development/compilers/orc { };
 
   metaocaml_3_09 = callPackage ../development/compilers/ocaml/metaocaml-3.09.nix { };