forked from ocaml/merlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
84 lines (75 loc) · 2.55 KB
/
flake.nix
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
description = "Merlin Nix Flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.menhir-repository = {
url = "gitlab:fpottier/menhir/20201216?host=gitlab.inria.fr";
flake = false;
};
outputs = { self, nixpkgs, flake-utils, menhir-repository }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
# Build with OCaml 5.2
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_2.overrideScope'
(_: osuper: {
# Override menhirLib to the pinned version
menhirLib = osuper.menhirLib.overrideAttrs (_: {
version = "20201216";
src = menhir-repository;
});
inherit (packages) merlin-lib dot-merlin-reader merlin;
});
inherit (ocamlPackages) buildDunePackage;
packages = rec {
default = merlin;
merlin-lib = buildDunePackage {
pname = "merlin-lib";
version = "dev";
src = ./.;
duneVersion = "3";
propagatedBuildInputs = with ocamlPackages; [ csexp ];
doCheck = true;
};
dot-merlin-reader = buildDunePackage {
pname = "dot-merlin-reader";
version = "dev";
src = ./.;
duneVersion = "3";
propagatedBuildInputs = [ ocamlPackages.findlib ];
buildInputs = [ merlin-lib ];
doCheck = true;
};
merlin = buildDunePackage {
pname = "merlin";
version = "dev";
src = ./.;
duneVersion = "3";
buildInputs = [
merlin-lib
dot-merlin-reader
ocamlPackages.menhirLib
ocamlPackages.menhirSdk
ocamlPackages.yojson
];
nativeBuildInputs = [ ocamlPackages.menhir pkgs.jq ];
nativeCheckInputs = [ dot-merlin-reader ];
checkInputs = with ocamlPackages; [ ppxlib ];
doCheck = true;
checkPhase = ''
runHook preCheck
patchShebangs tests/merlin-wrapper
dune build @check @runtest
runHook postCheck
'';
meta = with pkgs; { mainProgram = "ocamlmerlin"; };
};
};
in {
inherit packages;
devShells.default = pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = with ocamlPackages; [ merlin ];
};
});
}