about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix')
-rw-r--r--pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix29
1 files changed, 10 insertions, 19 deletions
diff --git a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix
index a4492b2ead388..e1f5f29aa2fb5 100644
--- a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix
+++ b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix
@@ -1,25 +1,16 @@
-{ 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:
 
-# for compat with ocaml-lsp
-let source =
-  if lib.versionAtLeast ocaml.version "4.13"
-  then {
-    version = "0.26.0";
-    sha256 = "sha256-AxSUq3cM7xCo9qocvrVmDkbDqmwM1FexEP7IWadeh30=";
-  } else {
-    version = "0.20.0";
-    sha256 = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk=";
-  };
-in
+let
+  # for compat with ocaml-lsp
+  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";