-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathflake.nix
85 lines (83 loc) · 2.92 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
{
description = "ocaml-re flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nix-ocaml/nix-overlays";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
extraBuildInputs = pkgs:
with pkgs.ocamlPackages; [
core_bench
memtrace
];
checkInputs = pkgs:
with pkgs.ocamlPackages; [
ounit
js_of_ocaml
ppx_expect
pkgs.nodejs-slim
];
devInputs = pkgs:
with pkgs.ocamlPackages; [
ocaml-lsp
pkgs.ocamlformat_0_26_2
csv
pkgs.tabview
];
makePackages = pkgs: rec {
default = re;
re = pkgs.ocamlPackages.buildDunePackage {
pname = "re";
version = "n/a";
src = ./.;
duneVersion = "3";
propagatedBuildInputs = with pkgs.ocamlPackages; [ seq ];
# Other check deps depend on re itself
checkInputs = with pkgs.ocamlPackages; [ ounit ];
doCheck = true;
};
};
ocamlVersionOverlay =
(ocaml: self: super: { ocamlPackages = ocaml super.ocaml-ng; });
framePointers = ocaml: ocaml.override { framePointerSupport = true; };
framePointersOverlay = self: super: {
ocamlPackages = super.ocamlPackages.overrideScope
(oself: osuper: { ocaml = framePointers osuper.ocaml; });
};
makeNixpkgs = ocaml:
nixpkgs.legacyPackages.${system}.appendOverlays
[ (ocamlVersionOverlay ocaml) ];
in rec {
devShells.test = let
pkgs = makeNixpkgs (ocaml: ocaml.ocamlPackages_5_2);
packages = makePackages pkgs;
in pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = extraBuildInputs pkgs ++ checkInputs pkgs;
};
devShells.default = let
pkgs = makeNixpkgs (ocaml: ocaml.ocamlPackages_5_2);
packages = makePackages pkgs;
in pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = extraBuildInputs pkgs ++ devInputs pkgs
++ checkInputs pkgs;
};
devShells.fp = let
pkgs = (makeNixpkgs (ocaml: ocaml.ocamlPackages_5_2)).appendOverlays
[ framePointersOverlay ];
packages = makePackages pkgs;
in pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = extraBuildInputs pkgs ++ devInputs pkgs;
};
devShells.memtrace = let
pkgs = makeNixpkgs (ocaml: ocaml.ocamlPackages_4_14);
packages = makePackages pkgs;
in pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = extraBuildInputs pkgs
++ [ pkgs.ocamlPackages.memtrace_viewer ];
};
});
}