Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 68 lines 1.8 kB view raw
1{ 2 lib, 3 fetchurl, 4 buildDunePackage, 5 ocaml, 6 astring, 7 result, 8 camlp-streams, 9 version ? "2.4.4", 10}: 11 12let 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}"; 34in 35 36lib.throwIf (param ? max_version && lib.versionAtLeast ocaml.version param.max_version) 37 "odoc-parser ${version} is not available for OCaml ${ocaml.version}" 38 39 buildDunePackage 40 rec { 41 pname = "odoc-parser"; 42 inherit version; 43 44 minimalOCamlVersion = "4.02"; 45 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 }; 54 55 propagatedBuildInputs = [ 56 astring 57 result 58 ] 59 ++ lib.optional (lib.versionAtLeast version "1.0.1") camlp-streams; 60 61 meta = { 62 description = "Parser for Ocaml documentation comments"; 63 license = lib.licenses.isc; 64 maintainers = with lib.maintainers; [ momeemt ]; 65 homepage = "https://github.com/ocaml-doc/odoc-parser"; 66 changelog = "https://github.com/ocaml-doc/odoc-parser/raw/${version}/CHANGES.md"; 67 }; 68 }