-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathflake.nix
91 lines (84 loc) · 2.45 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
# SPDX-FileCopyrightText: 2024-2025 Akira Komamura
# SPDX-License-Identifier: Unlicense
{
inputs = {
nixpkgs.url = "github:nix-ocaml/nix-overlays";
systems.url = "github:nix-systems/default";
};
outputs =
{
systems,
nixpkgs,
self,
...
}:
let
eachSystem =
f:
nixpkgs.lib.genAttrs (import systems) (
system:
f (
nixpkgs.legacyPackages.${system}.extend (
_self: super: {
# You can set the OCaml version to a particular release. Also, you
# may have to pin some packages to a particular revision if the
# devshell fail to build. This should be resolved in the upstream.
ocamlPackages = super.ocaml-ng.ocamlPackages_latest;
}
)
)
);
in
{
packages = eachSystem (
pkgs: with pkgs; {
default = ocamlPackages.buildDunePackage {
pname = throw "Name your OCaml package";
version = throw "Version your OCaml package";
duneVersion = "3";
src = self.outPath;
# Uncomment if you need the executable of dream_eml during build
# nativeBuildInputs = [
# ocamlPackages.dream
# ];
buildInputs = with ocamlPackages; [ ocaml-syntax-shims ];
propagatedBuildInputs = with ocamlPackages; [
# Add OCaml dependencies required for your project
# Jane Street
base
core
core_unix
# Some common dependencies
# eio
# eio_main
# yojson
# ppx_yojson_conv
];
};
}
);
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
inputsFrom = [ self.packages.${pkgs.system}.default ];
packages = (
with pkgs.ocamlPackages;
[
ocaml-lsp
ocamlformat
ocp-indent
utop
# Needed for generating documentation
opam
odoc
odig
# This may fail to build, so it is turned off by default.
# (sherlodoc.override { enableServe = true; })
]
)
# Enable file watcher.
# ++ lib.optional pkgs.stdenv.isLinux pkgs.inotify-tools
;
};
});
};
}