Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 fetchurl, 4 buildDunePackage, 5 ocaml, 6 findlib, 7 cppo, 8 ppxlib, 9 ppx_derivers, 10 result, 11 ounit, 12 ounit2, 13 ocaml-migrate-parsetree, 14 version ? 15 if lib.versionAtLeast ppxlib.version "0.32" then 16 "6.0.3" 17 else if lib.versionAtLeast ppxlib.version "0.20" then 18 "5.2.1" 19 else if lib.versionAtLeast ppxlib.version "0.15" then 20 "5.1" 21 else 22 "5.0", 23}: 24 25let 26 hash = 27 { 28 "6.0.3" = "sha256-N0qpezLF4BwJqXgQpIv6IYwhO1tknkRSEBRVrBnJSm0="; 29 "5.2.1" = "sha256:11h75dsbv3rs03pl67hdd3lbim7wjzh257ij9c75fcknbfr5ysz9"; 30 "5.1" = "sha256:1i64fd7qrfzbam5hfbl01r0sx4iihsahcwqj13smmrjlnwi3nkxh"; 31 "5.0" = "sha256:0fkzrn4pdyvf1kl0nwvhqidq01pnq3ql8zk1jd56hb0cxaw851w3"; 32 } 33 ."${version}"; 34in 35 36buildDunePackage rec { 37 pname = "ppx_deriving"; 38 inherit version; 39 40 src = fetchurl { 41 url = "https://github.com/ocaml-ppx/ppx_deriving/releases/download/v${version}/ppx_deriving-${lib.optionalString (lib.versionOlder version "6.0") "v"}${version}.tbz"; 42 inherit hash; 43 }; 44 45 strictDeps = true; 46 47 nativeBuildInputs = [ cppo ]; 48 buildInputs = [ 49 findlib 50 ppxlib 51 ]; 52 propagatedBuildInputs = 53 lib.optional (lib.versionOlder version "5.2") ocaml-migrate-parsetree 54 ++ [ 55 ppx_derivers 56 ] 57 ++ lib.optional (lib.versionOlder version "6.0") result; 58 59 doCheck = lib.versionAtLeast ocaml.version "4.08"; 60 checkInputs = [ 61 (if lib.versionAtLeast version "5.2" then ounit2 else ounit) 62 ]; 63 64 meta = with lib; { 65 description = "Library simplifying type-driven code generation on OCaml >=4.02"; 66 maintainers = [ maintainers.maurer ]; 67 license = licenses.mit; 68 }; 69}