forked from ocaml/merlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
87 lines (85 loc) · 2.6 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
85
86
87
{
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}".extend (_: super: {
ocamlPackages = super.ocamlPackages.overrideScope' (_: osuper: {
menhirLib = osuper.menhirLib.overrideAttrs (_: {
version = "20201216";
src = menhir-repository;
});
});
});
inherit (pkgs.ocamlPackages) buildDunePackage;
in
rec {
packages = rec {
default = merlin;
merlin-lib = buildDunePackage {
pname = "merlin-lib";
version = "dev";
src = ./.;
duneVersion = "3";
propagatedBuildInputs = with pkgs.ocamlPackages; [
csexp
];
doCheck = true;
};
dot-merlin-reader = buildDunePackage {
pname = "dot-merlin-reader";
version = "dev";
src = ./.;
duneVersion = "3";
propagatedBuildInputs = [
pkgs.ocamlPackages.findlib
];
buildInputs = [
merlin-lib
];
doCheck = true;
};
merlin = buildDunePackage {
pname = "merlin";
version = "dev";
src = ./.;
duneVersion = "3";
buildInputs = [
merlin-lib
dot-merlin-reader
pkgs.ocamlPackages.menhirLib
pkgs.ocamlPackages.menhirSdk
pkgs.ocamlPackages.yojson
];
nativeBuildInputs = [
pkgs.ocamlPackages.menhir
pkgs.jq
];
nativeCheckInputs = [ dot-merlin-reader ];
checkInputs = with pkgs.ocamlPackages; [
ppxlib
];
doCheck = true;
checkPhase = ''
runHook preCheck
patchShebangs tests/merlin-wrapper
dune build @check @runtest
runHook postCheck
'';
meta = with pkgs; {
mainProgram = "ocamlmerlin";
};
};
};
devShells.default = pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = with pkgs.ocamlPackages; [ ocaml-lsp ];
};
});
}