Commit 32a2a085 authored by Jules Aguillon's avatar Jules Aguillon
Browse files

Link version for ocamlformat{,-lib,-rpc-lib}

The default (latest) version is now defined in 'generic.nix' and is the
same for the three packages.

'ocamlformat-rpc-lib' is no longer defined separately and also use the
latest version as a default.
parent 1bef913e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
{ lib, fetchurl, version, astring, base, camlp-streams, cmdliner_1_0
{ lib, fetchurl, version ? "0.26.1", astring, base, camlp-streams, cmdliner_1_0
, cmdliner_1_1, csexp, dune-build-info, either, fix, fpath, menhirLib, menhirSdk
, ocaml-version, ocp-indent, odoc-parser, result, stdio, uuseg, uutf }:
, ocaml-version, ocp-indent, odoc-parser, result, stdio, uuseg, uutf, ... }:

# The ocamlformat package have been split into two in version 0.25.1:
# one for the library and one for the executable.
@@ -27,6 +27,8 @@ rec {
    }."${version}";
  };

  inherit version;

  odoc-parser_v = odoc-parser.override {
    version = if lib.versionAtLeast version "0.24.0" then
      "2.0.0"
+3 −2
Original line number Diff line number Diff line
{ lib, callPackage, buildDunePackage, menhir, version ? "0.25.1" }:
# Version can be selected with the 'version' argument, see generic.nix.
{ lib, callPackage, buildDunePackage, menhir, ... }@args:

let inherit (callPackage ./generic.nix { inherit version; }) src library_deps;
let inherit (callPackage ./generic.nix args) src version library_deps;

in assert (lib.versionAtLeast version "0.25.1");

+10 −19
Original line number Diff line number Diff line
{ lib, fetchurl, buildDunePackage, ocaml, csexp, sexplib0 }:
# Version can be selected with the 'version' argument, see generic.nix.
{ lib, fetchurl, buildDunePackage, ocaml, csexp, sexplib0, callPackage, ... }@args:

let
  # for compat with ocaml-lsp
let source =
  if lib.versionAtLeast ocaml.version "4.13"
  then {
    version = "0.26.1";
    sha256 = "sha256-2gBuQn8VuexhL7gI1EZZm9m3w+4lq+s9VVdHpw10xtc=";
  } else {
    version = "0.20.0";
    sha256 = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk=";
  };
in
  version_arg =
    if lib.versionAtLeast ocaml.version "4.13" then {} else { version = "0.20.0"; };

buildDunePackage rec {
  pname = "ocamlformat-rpc-lib";
  inherit (source) version;
  inherit (callPackage ./generic.nix (args // version_arg)) src version;

  src = fetchurl {
    url = "https://github.com/ocaml-ppx/ocamlformat/releases/download/${version}/ocamlformat-${version}.tbz";
    inherit (source) sha256;
  };
in buildDunePackage rec {
  pname = "ocamlformat-rpc-lib";
  inherit src version;

  minimalOCamlVersion = "4.08";
  duneVersion = "3";
+4 −3
Original line number Diff line number Diff line
# Version can be selected with the 'version' argument, see generic.nix.
{ lib
, callPackage
, buildDunePackage
@@ -5,10 +6,10 @@
, re
, ocamlformat-lib
, menhir
, version ? "0.26.1"
}:
, ...
}@args:

let inherit (callPackage ./generic.nix { inherit version; }) src library_deps;
let inherit (callPackage ./generic.nix args) src version library_deps;
in

lib.throwIf (lib.versionAtLeast ocaml.version "5.0" && !lib.versionAtLeast version "0.23")