Skip to content

Commit 4321639

Browse files
authored
chore(nix): remove flake-utils (#873)
1 parent f0cf5e4 commit 4321639

File tree

2 files changed

+86
-83
lines changed

2 files changed

+86
-83
lines changed

flake.lock

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 82 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,92 +3,98 @@
33

44
inputs = {
55
nix-filter.url = "github:numtide/nix-filter";
6-
flake-utils.url = "github:numtide/flake-utils";
7-
nixpkgs = {
8-
url = "github:nix-ocaml/nix-overlays";
9-
inputs.flake-utils.follows = "flake-utils";
10-
};
6+
nixpkgs.url = "github:nix-ocaml/nix-overlays";
117
};
128

13-
outputs = { self, nixpkgs, flake-utils, nix-filter }:
14-
flake-utils.lib.eachDefaultSystem (system:
15-
let
16-
pkgs = nixpkgs.legacyPackages."${system}".appendOverlays [
17-
(self: super: { ocamlPackages = super.ocaml-ng.ocamlPackages_5_2; })
18-
];
19-
20-
makeDevShell = { packages, release-mode ? false }:
21-
pkgs.mkShell {
22-
# dontDetectOcamlConflicts = true;
23-
inputsFrom = pkgs.lib.attrValues packages;
24-
nativeBuildInputs =
25-
with pkgs.ocamlPackages; [ ocamlformat pkgs.nodejs_latest ]
26-
++ pkgs.lib.optionals release-mode (with pkgs; [
27-
cacert
28-
curl
29-
ocamlPackages.dune-release
30-
ocamlPackages.odoc
31-
git
32-
]);
33-
propagatedBuildInputs = with pkgs.ocamlPackages; [ merlin ];
34-
};
35-
in
36-
37-
rec {
38-
packages = with pkgs.ocamlPackages; rec {
39-
reason-react-ppx = buildDunePackage {
40-
pname = "reason-react-ppx";
41-
version = "n/a";
42-
src = with nix-filter.lib; filter {
43-
root = ./.;
44-
include = [
45-
"dune-project"
46-
"dune"
47-
"reason-react-ppx.opam"
48-
"reason-react.opam"
49-
"ppx"
50-
];
9+
outputs = { self, nixpkgs, nix-filter }:
10+
let
11+
forAllSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system:
12+
let
13+
pkgs = nixpkgs.legacyPackages.${system}.extend (self: super: {
14+
ocamlPackages = super.ocaml-ng.ocamlPackages_5_2.overrideScope (oself: osuper: {
15+
ppxlib = osuper.ppxlib.overrideAttrs (o: {
16+
propagatedBuildInputs = o.propagatedBuildInputs ++ [ osuper.stdio ];
17+
});
18+
});
19+
});
20+
in
21+
f pkgs);
22+
in
23+
{
24+
packages = forAllSystems (pkgs:
25+
let
26+
inherit (pkgs.ocamlPackages)
27+
buildDunePackage melange merlin ppxlib reason;
28+
packages = rec {
29+
reason-react-ppx = buildDunePackage {
30+
pname = "reason-react-ppx";
31+
version = "n/a";
32+
src = with nix-filter.lib; filter {
33+
root = ./.;
34+
include = [
35+
"dune-project"
36+
"dune"
37+
"reason-react-ppx.opam"
38+
"reason-react.opam"
39+
"ppx"
40+
];
41+
};
42+
# Due to a Reason version mismatch, the generated OCaml PPX diff
43+
# looks different
44+
doCheck = false;
45+
checkInputs = [ ];
46+
checkPhase = "dune build @runtest -p reason-react,reason-react-ppx";
47+
nativeCheckInputs = [ reason merlin pkgs.jq ];
48+
propagatedBuildInputs = [ ppxlib ];
5149
};
52-
# Due to a Reason version mismatch, the generated OCaml PPX diff
53-
# looks different
54-
doCheck = false;
55-
checkInputs = [ ];
56-
checkPhase = "dune build @runtest -p reason-react,reason-react-ppx";
57-
nativeCheckInputs = [ reason merlin pkgs.jq ];
58-
propagatedBuildInputs = [ ppxlib ];
59-
};
6050

61-
reason-react = buildDunePackage {
62-
pname = "reason-react";
63-
version = "n/a";
64-
src = with nix-filter.lib; filter {
65-
root = ./.;
66-
include = [
67-
"dune-project"
68-
"dune"
69-
"reason-react-ppx.opam"
70-
"reason-react.opam"
71-
"src"
72-
"test"
73-
];
51+
reason-react = buildDunePackage {
52+
pname = "reason-react";
53+
version = "n/a";
54+
src = with nix-filter.lib; filter {
55+
root = ./.;
56+
include = [
57+
"dune-project"
58+
"dune"
59+
"reason-react-ppx.opam"
60+
"reason-react.opam"
61+
"src"
62+
"test"
63+
];
64+
};
65+
doCheck = true;
66+
nativeBuildInputs = [ melange reason ];
67+
propagatedBuildInputs = [ melange reason-react-ppx ];
7468
};
75-
doCheck = true;
76-
nativeBuildInputs = [ pkgs.ocamlPackages.melange reason ];
77-
propagatedBuildInputs = [
78-
pkgs.ocamlPackages.melange
79-
reason-react-ppx
80-
];
8169
};
70+
in
71+
packages // { default = packages.reason-react; });
8272

83-
default = packages.reason-react;
84-
};
85-
86-
devShells = {
73+
devShells = forAllSystems (pkgs:
74+
let
75+
makeDevShell = { packages, release-mode ? false }:
76+
pkgs.mkShell {
77+
# dontDetectOcamlConflicts = true;
78+
inputsFrom = pkgs.lib.attrValues packages;
79+
nativeBuildInputs =
80+
with pkgs.ocamlPackages; [ ocamlformat pkgs.nodejs_latest ]
81+
++ pkgs.lib.optionals release-mode (with pkgs; [
82+
cacert
83+
curl
84+
ocamlPackages.dune-release
85+
ocamlPackages.odoc
86+
git
87+
]);
88+
propagatedBuildInputs = with pkgs.ocamlPackages; [ merlin ];
89+
};
90+
packages = self.packages.${pkgs.system};
91+
in
92+
{
8793
default = makeDevShell { inherit packages; };
8894
release = makeDevShell {
8995
inherit packages;
9096
release-mode = true;
9197
};
92-
};
93-
});
98+
});
99+
};
94100
}

0 commit comments

Comments
 (0)