summaryrefslogtreecommitdiffstats
path: root/pkgs/development/rocq-modules/autosubst-ocaml/default.nix
blob: f949d2497b053b343226eb3b9da38992833a11bb (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
{
  lib,
  mkCoqDerivation,
  coq,
  version ? null,
}:

mkCoqDerivation {
  pname = "autosubst-ocaml";
  owner = "uds-psl";

  release."1.1+9.0".hash = "sha256-fCQjmF+0ik2QdKog61VfIv5ERmw+AJO8y5+CWmDGGk0=";
  release."1.1+8.20".hash = "sha256-S3uKkwbGFsvauP9lKc3UsdszHahbZQhlOOK3fCBXlSE=";
  release."1.1+8.19".hash = "sha256-AGbhw/6lg4GpDE6hZBhau9DLW7HVXa0UzGvJfSV8oHE=";

  inherit version;
  defaultVersion =
    with lib.versions;
    lib.switch coq.coq-version [
      {
        case = isEq "9.0";
        out = "1.1+9.0";
      }
      {
        case = isEq "8.20";
        out = "1.1+8.20";
      }
      {
        case = isEq "8.19";
        out = "1.1+8.19";
      }
    ] null;

  buildInputs = with coq.ocamlPackages; [
    angstrom
    ocamlgraph
    ppx_deriving
    ppxlib
  ];
  useDune = true;

  buildPhase = ''
    dune build
  '';

  installPhase = ''
    dune install --prefix $out --libdir $OCAMLFIND_DESTDIR
  '';

  meta = {
    description = "OCaml reimplementation of the Autosubst 2 code generator";
    homepage = "https://github.com/uds-psl/autosubst-ocaml";
    mainProgram = "autosubst";
    maintainers = with lib.maintainers; [ chen ];
    license = lib.licenses.mit;
  };
}