-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
81 lines (69 loc) · 2.55 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
opam-repository = {
flake = false;
url = "github:ocaml/opam-repository";
};
opam2nix = {
url = "github:vapourismo/opam-nix-integration";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.opam-repository.follows = "opam-repository";
};
};
outputs = inputs:
with inputs;
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [opam2nix.overlays.default];
};
opamPackages = pkgs.opamPackages.overrideScope (
pkgs.lib.composeManyExtensions [
(final: prev: {
repository = prev.repository.override {src = opam-repository;};
})
(
final: prev:
prev.repository.select {
opams = [
{
name = "lltz";
src = ./.;
opam = ./lltz.opam;
}
];
packageConstraints = ["fmt" "utop" "ocamlformat" "ocamlformat-rpc" "ocaml-lsp-server"];
}
)
# An override that patches opam packages that are missing dependencies from their opam files
(
final: prev: {
# Add ocp-indent to ocamlformat-lib
ocamlformat-lib = prev.ocamlformat-lib.overrideAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or []) ++ [prev.ocp-indent];
});
# Add fmt to logs
logs = prev.logs.overrideAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [prev.fmt];
});
# zarith = prev.zarith.overrideAttrs (old: {
# buildInputs = (old.buildInputs or []) ++ [pkgs.gmp];
# });
conf-gmp = final.lib.overrideNativeDepends prev.conf-gmp [pkgs.gmp];
conf-pkg-config = final.lib.overrideNativeDepends prev.conf-pkg-config [pkg-config];
}
)
]
);
in {
packages.default = opamPackages.lltz;
devShells.default = pkgs.mkShell {
name = "lltz-shell";
inputsFrom = [opamPackages.lltz];
buildInputs = with pkgs; [alejandra gmp pkg-config] ++ (with opamPackages; [utop ocamlformat ocamlformat-rpc ocaml-lsp-server]);
};
});
}