Skip to content

Commit 4a0d6b5

Browse files
committed
Add devbox support
1 parent 731b337 commit 4a0d6b5

File tree

5 files changed

+154
-1
lines changed

5 files changed

+154
-1
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Build PPX:
7575
esy build
7676
```
7777

78-
**Nix flow**
78+
**Nix/Devbox flow**
7979
Build PPX:
8080

8181
```shell

devbox.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"packages": [
3+
"path:./nix/ocaml#ocaml",
4+
"path:./nix/ocaml#dune",
5+
"path:./nix/ocaml#reason",
6+
"path:./nix/ocaml#result",
7+
"path:./nix/ocaml#findlib",
8+
"path:./nix/ocaml#ppxlib",
9+
"path:./nix/ocaml#alcotest",
10+
"path:./nix/ocaml#merlin",
11+
"path:./nix/ocaml#lsp",
12+
"nodejs",
13+
"yarn"
14+
],
15+
"shell": {
16+
"init_hook": [
17+
"export PATH=$PATH:node_modules/.bin"
18+
]
19+
}
20+
}

devbox.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"nodejs": {
5+
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#nodejs",
6+
"source": "nixpkg"
7+
},
8+
"path:./nix/ocaml#alcotest": {},
9+
"path:./nix/ocaml#dune": {},
10+
"path:./nix/ocaml#findlib": {},
11+
"path:./nix/ocaml#lsp": {},
12+
"path:./nix/ocaml#merlin": {},
13+
"path:./nix/ocaml#ocaml": {},
14+
"path:./nix/ocaml#ppxlib": {},
15+
"path:./nix/ocaml#reason": {},
16+
"path:./nix/ocaml#result": {},
17+
"yarn": {
18+
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#yarn",
19+
"source": "nixpkg"
20+
}
21+
}
22+
}

nix/ocaml/flake.lock

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

nix/ocaml/flake.nix

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
description = "OCaml 4.12 packages for ReScript PPX development";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
overlay = (final: prev: {
13+
ocaml-ng = prev.ocaml-ng // {
14+
ocamlPackages_4_12 = prev.ocaml-ng.ocamlPackages_4_12 // {
15+
ppxlib = prev.ocaml-ng.ocamlPackages_4_12.ppxlib.overrideAttrs (_: {
16+
version = "git";
17+
src = pkgs.fetchFromGitHub {
18+
owner = "zth";
19+
repo = "ppxlib";
20+
rev = "32f83395fb89693a873541298b6367449f23bc4a";
21+
sha256 = "sha256-8bkmeFh5Unda8n3F2MQWi81QPt2NdkwFcy4wZTJ0STo=";
22+
};
23+
patches = [];
24+
});
25+
};
26+
};
27+
});
28+
29+
pkgs = import nixpkgs {
30+
inherit system;
31+
overlays = [ overlay ];
32+
};
33+
34+
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_12;
35+
in
36+
{
37+
packages = {
38+
ocaml = ocamlPackages.ocaml;
39+
dune = ocamlPackages.dune_3;
40+
reason = ocamlPackages.reason;
41+
result = ocamlPackages.result;
42+
findlib = ocamlPackages.findlib;
43+
ppxlib = ocamlPackages.ppxlib;
44+
alcotest = ocamlPackages.alcotest;
45+
merlin = ocamlPackages.merlin;
46+
lsp = ocamlPackages.ocaml-lsp;
47+
};
48+
}
49+
);
50+
}

0 commit comments

Comments
 (0)