python312Packages.pint-xarray: init at 0.4 (#377344)
[NixPkgs.git] / pkgs / development / ocaml-modules / odoc-parser / default.nix
blob04c8c8c7c36053e6d62c5e93d90fbe10f181d187
2   lib,
3   fetchurl,
4   buildDunePackage,
5   ocaml,
6   astring,
7   result,
8   camlp-streams,
9   version ? "2.4.4",
12 let
13   param =
14     {
15       "2.4.4" = {
16         sha256 = "sha256-fiU6VbXI9hD54LSJQOza8hwBVTFDr5O0DJmMMEmeUfM=";
17       };
18       "2.0.0" = {
19         sha256 = "sha256-QHkZ+7DrlXYdb8bsZ3dijZSqGQc0O9ymeLGIC6+zOSI=";
20       };
21       "1.0.1" = {
22         sha256 = "sha256-orvo5CAbYOmAurAeluQfK6CwW6P1C0T3WDfoovuQfSw=";
23       };
24       "1.0.0" = {
25         sha256 = "sha256-tqoI6nGp662bK+vE2h7aDXE882dObVfRBFnZNChueqE=";
26         max_version = "5.0";
27       };
28       "0.9.0" = {
29         sha256 = "sha256-3w2tG605v03mvmZsS2O5c71y66O3W+n3JjFxIbXwvXk=";
30         max_version = "5.0";
31       };
32     }
33     ."${version}";
36 lib.throwIf (param ? max_version && lib.versionAtLeast ocaml.version param.max_version)
37   "odoc-parser ${version} is not available for OCaml ${ocaml.version}"
39   buildDunePackage
40   rec {
41     pname = "odoc-parser";
42     inherit version;
44     minimalOCamlVersion = "4.02";
46     src = fetchurl {
47       url =
48         if lib.versionAtLeast version "2.4" then
49           "https://github.com/ocaml/odoc/releases/download/${version}/odoc-${version}.tbz"
50         else
51           "https://github.com/ocaml-doc/odoc-parser/releases/download/${version}/odoc-parser-${version}.tbz";
52       inherit (param) sha256;
53     };
55     propagatedBuildInputs = [
56       astring
57       result
58     ] ++ lib.optional (lib.versionAtLeast version "1.0.1") camlp-streams;
60     meta = {
61       description = "Parser for Ocaml documentation comments";
62       license = lib.licenses.isc;
63       maintainers = with lib.maintainers; [ momeemt ];
64       homepage = "https://github.com/ocaml-doc/odoc-parser";
65       changelog = "https://github.com/ocaml-doc/odoc-parser/raw/${version}/CHANGES.md";
66     };
67   }