-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
74 lines (69 loc) · 2.26 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
ocaml-overlays.url = "github:anmonteiro/nix-overlays";
ocaml-overlays.inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, nix-filter, ocaml-overlays }:
let
supported_ocaml_versions = [ "ocamlPackages_4_13" "ocamlPackages_5_00" ];
out = system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ ocaml-overlays.overlays."${system}".default ];
};
ocamlPackages_dev = pkgs.ocaml-ng.ocamlPackages_5_00;
pollinate = (pkgs.callPackage ./nix {
inherit nix-filter;
doCheck = true;
ocamlPackages = ocamlPackages_dev;
});
in {
formatter = pkgs.callPackage ./nix/formatter.nix { };
devShells = {
default = (pkgs.mkShell {
inputsFrom = [ pollinate ];
buildInputs = with pkgs;
with ocamlPackages_dev; [
ocaml-lsp
ocamlformat_0_20_1
odoc
ocaml
dune_3
nixfmt
treefmt
];
});
};
packages = builtins.foldl' (prev: ocamlVersion:
prev // {
"pollinate_${ocamlVersion}" = pollinate.override {
ocamlPackages = pkgs.ocaml-ng."${ocamlVersion}";
};
}) {
# ocaml 5.00 version is available as default, pollinate and pollinate_ocamlPackage_5_00
inherit pollinate;
default = pollinate;
} supported_ocaml_versions;
};
in with flake-utils.lib;
eachSystem [
system.x86_64-linux
system.aarch64-linux
system.x86_64-darwin
system.aarch64-darwin
] out // {
overlays.default =
import ./nix/overlay.nix supported_ocaml_versions nix-filter;
hydraJobs = {
x86_64-linux.default = self.packages.x86_64-linux;
aarch64-darwin.default = self.packages.aarch64-darwin;
};
};
}