-
Notifications
You must be signed in to change notification settings - Fork 347
/
flake.nix
94 lines (87 loc) · 2.85 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
88
89
90
91
92
93
94
{
description = "Reason React Nix Flake";
inputs = {
nix-filter.url = "github:numtide/nix-filter";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs = {
url = "github:nix-ocaml/nix-overlays";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, nix-filter }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}".appendOverlays [
(self: super: { ocamlPackages = super.ocaml-ng.ocamlPackages_5_2; })
];
makeDevShell = { packages, release-mode ? false }:
pkgs.mkShell {
# dontDetectOcamlConflicts = true;
inputsFrom = pkgs.lib.attrValues packages;
nativeBuildInputs =
with pkgs.ocamlPackages; [ ocamlformat pkgs.nodejs_latest ]
++ pkgs.lib.optionals release-mode (with pkgs; [
cacert
curl
ocamlPackages.dune-release
ocamlPackages.odoc
git
]);
propagatedBuildInputs = with pkgs.ocamlPackages; [ merlin ];
};
in
rec {
packages = with pkgs.ocamlPackages; rec {
reason-react-ppx = buildDunePackage {
pname = "reason-react-ppx";
version = "n/a";
src = with nix-filter.lib; filter {
root = ./.;
include = [
"dune-project"
"dune"
"reason-react-ppx.opam"
"reason-react.opam"
"ppx"
];
};
# Due to a Reason version mismatch, the generated OCaml PPX diff
# looks different
doCheck = false;
checkInputs = [ ];
checkPhase = "dune build @runtest -p reason-react,reason-react-ppx";
nativeCheckInputs = [ reason merlin pkgs.jq ];
propagatedBuildInputs = [ ppxlib ];
};
reason-react = buildDunePackage {
pname = "reason-react";
version = "n/a";
src = with nix-filter.lib; filter {
root = ./.;
include = [
"dune-project"
"dune"
"reason-react-ppx.opam"
"reason-react.opam"
"src"
"test"
];
};
doCheck = true;
nativeBuildInputs = [ pkgs.ocamlPackages.melange reason ];
propagatedBuildInputs = [
pkgs.ocamlPackages.melange
reason-react-ppx
];
};
default = packages.reason-react;
};
devShells = {
default = makeDevShell { inherit packages; };
release = makeDevShell {
inherit packages;
release-mode = true;
};
};
});
}