summaryrefslogtreecommitdiffstats
path: root/pkgs/development/ocaml-modules/ppx_deriving_yaml/default.nix
blob: 4f1fedbb9165c41eca2ee2d8296a69e7f82ec8b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  lib,
  buildDunePackage,
  ocaml,
  fetchurl,
  ppxlib,
  alcotest,
  mdx,
  ppx_deriving,
  yaml,
}:

let
  param =
    if lib.versionAtLeast ppxlib.version "0.36" then
      {
        version = "0.4.1";
        hash = "sha256-3CvvMEOq/3I3WJ6X5EyopiaMjshZoEMPk2K4Lx0ldSo=";
      }
    else
      {
        version = "0.4.0";
        hash = "sha256-MVwCFAZY9Ui1gOckfbbj882w2aloHCGmJhpL1BDUEAg=";
      };
in

buildDunePackage (finalAttrs: {
  pname = "ppx_deriving_yaml";
  inherit (param) version;

  env =
    # Fix build with gcc15
    lib.optionalAttrs
      (lib.versions.majorMinor ocaml.version == "4.13" || lib.versions.majorMinor ocaml.version == "5.0")
      {
        NIX_CFLAGS_COMPILE = "-std=gnu11";
      };

  src = fetchurl {
    url = "https://github.com/patricoferris/ppx_deriving_yaml/releases/download/v${finalAttrs.version}/ppx_deriving_yaml-${finalAttrs.version}.tbz";
    inherit (param) hash;
  };

  propagatedBuildInputs = [
    ppxlib
    ppx_deriving
    yaml
  ];

  doCheck = true;
  checkInputs = [
    alcotest
    mdx
  ];
  nativeCheckInputs = [ mdx.bin ];

  meta = {
    description = "YAML codec generator for OCaml";
    homepage = "https://github.com/patricoferris/ppx_deriving_yaml";
    license = lib.licenses.isc;
    maintainers = [ ];
  };
})