-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
67 lines (64 loc) · 1.94 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
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.follows = "opam-nix/nixpkgs";
opam-nix = {
url = "github:tweag/opam-nix";
inputs.opam-repository.follows = "opam-repository";
};
opam-repository = {
url = "github:ocaml/opam-repository";
flake = false;
};
git-subrepo-src = {
url =
"github:rgrinberg/git-subrepo?rev=8fb6be3fb1500ab845081fc26ecdb950e9c0438c";
flake = false;
};
};
outputs = { self, flake-utils, opam-nix, nixpkgs, ... }@inputs:
let package = "ocaml-lsp-server";
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
on = opam-nix.lib.${system};
localPackages = {
jsonrpc = null;
lsp = null;
};
devPackages = {
menhir = null;
ppx_yojson_conv = null;
cinaps = null;
ppx_expect = null;
ocamlformat-rpc = null;
ocamlfind = "1.9.2";
};
allPackages = localPackages // devPackages;
in {
legacyPackages = let
scope =
on.buildOpamProject { resolveArgs = { with-test = true; }; } package
./. (allPackages);
overlay = final: prev: {
git-subrepo =
prev.git-subrepo.overrideAttr (old: {
src = inputs.git-subrepo-src;
});
};
in scope.overrideScope' overlay;
defaultPackage = self.legacyPackages.${system}.${package};
devShell = pkgs.mkShell {
nativeBuildInputs = let scope = self.legacyPackages.${system};
in with pkgs;
[
# dev tools
git-subrepo
ocamlformat_0_21_0
yarn
] ++ (builtins.map (s: builtins.getAttr s scope)
(builtins.attrNames allPackages));
inputsFrom = [ self.defaultPackage.${system} ];
};
});
}