Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 104 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildDunePackage, 6 ocaml, 7 findlib, 8 cppo, 9}: 10 11if lib.versionAtLeast ocaml.version "5.2" then 12 throw "ppx_tools is not available for OCaml ${ocaml.version}" 13else 14 15 let 16 param = 17 let 18 v6_6 = { 19 version = "6.6"; 20 sha256 = "sha256-QhuaQ9346a3neoRM4GrOVzjR8fg9ysMZR1VzNgyIQtc="; 21 nativeBuildInputs = [ cppo ]; 22 buildInputs = [ cppo ]; 23 }; 24 in 25 { 26 "4.02" = { 27 version = "5.0+4.02.0"; 28 sha256 = "16drjk0qafjls8blng69qiv35a84wlafpk16grrg2i3x19p8dlj8"; 29 }; 30 "4.03" = { 31 version = "5.0+4.03.0"; 32 sha256 = "061v1fl5z7z3ywi4ppryrlcywnvnqbsw83ppq72qmkc7ma4603jg"; 33 }; 34 "4.04" = { 35 version = "unstable-20161114"; 36 rev = "49c08e2e4ea8fef88692cd1dcc1b38a9133f17ac"; 37 sha256 = "0ywzfkf5brj33nwh49k9if8x8v433ral25f3nbklfc9vqr06zrfl"; 38 }; 39 "4.05" = { 40 version = "5.0+4.05.0"; 41 sha256 = "1jvvhk6wnkvm7b9zph309ihsc0hyxfpahmxxrq19vx8c674jsdm4"; 42 }; 43 "4.06" = { 44 version = "5.1+4.06.0"; 45 sha256 = "1ww4cspdpgjjsgiv71s0im5yjkr3544x96wsq1vpdacq7dr7zwiw"; 46 }; 47 "4.07" = { 48 version = "5.1+4.06.0"; 49 sha256 = "1ww4cspdpgjjsgiv71s0im5yjkr3544x96wsq1vpdacq7dr7zwiw"; 50 }; 51 "4.08" = v6_6; 52 "4.09" = v6_6; 53 "4.10" = v6_6; 54 "4.11" = v6_6; 55 "4.12" = v6_6; 56 "4.13" = v6_6; 57 "4.14" = v6_6; 58 "5.0" = v6_6; 59 "5.1" = v6_6; 60 } 61 .${ocaml.meta.branch}; 62 in 63 64 let 65 src = fetchFromGitHub { 66 owner = "alainfrisch"; 67 repo = pname; 68 rev = param.rev or param.version; 69 inherit (param) sha256; 70 }; 71 pname = "ppx_tools"; 72 meta = with lib; { 73 description = "Tools for authors of ppx rewriters"; 74 homepage = "https://www.lexifi.com/ppx_tools"; 75 license = licenses.mit; 76 maintainers = with maintainers; [ vbgl ]; 77 }; 78 in 79 if lib.versionAtLeast param.version "6.0" then 80 buildDunePackage { 81 inherit pname src meta; 82 inherit (param) version buildInputs nativeBuildInputs; 83 } 84 else 85 stdenv.mkDerivation { 86 name = "ocaml${ocaml.version}-${pname}-${param.version}"; 87 88 inherit src; 89 90 nativeBuildInputs = [ 91 ocaml 92 findlib 93 ]; 94 95 strictDeps = true; 96 97 createFindlibDestdir = true; 98 99 dontStrip = true; 100 101 meta = meta // { 102 inherit (ocaml.meta) platforms; 103 }; 104 }