Skip to content

Commit c275a13

Browse files
committed
Add nix.flake for easy devshell.
1 parent 2679b11 commit c275a13

File tree

4 files changed

+309
-1
lines changed

4 files changed

+309
-1
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,6 @@ Sessionx.vim
186186
*~
187187
.*.swp
188188
# Auto-generated tag files
189-
tags
189+
tags
190+
# nix flake stuff
191+
.direnv

flake.lock

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

flake.nix

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
description = "styled-ppx";
3+
4+
inputs = {
5+
nixpkgs = {
6+
url = "github:nix-ocaml/nix-overlays";
7+
inputs.flake-utils.follows = "flake-utils";
8+
};
9+
10+
ocaml-overlay = {
11+
url = "github:nix-ocaml/nix-overlays";
12+
inputs.nixpkgs.follows = "nixpkgs";
13+
};
14+
15+
flake-utils = {
16+
url = "github:numtide/flake-utils";
17+
};
18+
19+
quickjs = {
20+
type = "git";
21+
url = "https://github.com/ml-in-barcelona/quickjs.ml.git";
22+
submodules = true;
23+
flake = false;
24+
};
25+
26+
server-reason-react = {
27+
url = "github:ml-in-barcelona/server-reason-react";
28+
flake = false;
29+
};
30+
};
31+
32+
outputs =
33+
inputs@{
34+
self,
35+
nixpkgs,
36+
flake-utils,
37+
...
38+
}:
39+
flake-utils.lib.eachDefaultSystem (
40+
system:
41+
let
42+
version = "0.59.2+dev";
43+
pkgs = nixpkgs.legacyPackages."${system}".extend (
44+
self: super: {
45+
ocaml = super.ocaml-ng.ocamlPackages_5_1;
46+
ocamlPackages = super.ocaml-ng.ocamlPackages_5_1;
47+
# .overrideScope (
48+
# oself: osuper: { ppxlib = osuper.ppxlib.override ({ version = "0.32.1"; }); }
49+
# );
50+
}
51+
);
52+
inherit (pkgs) ocamlPackages mkShell;
53+
inherit (ocamlPackages) buildDunePackage;
54+
55+
quickjs = buildDunePackage {
56+
pname = "quickjs";
57+
version = "";
58+
propagatedBuildInputs = with ocamlPackages; [
59+
dune_3
60+
ocaml
61+
integers
62+
ctypes
63+
];
64+
src = inputs.quickjs;
65+
};
66+
67+
server-reason-react = buildDunePackage {
68+
pname = "server-reason-react";
69+
version = "";
70+
nativeBuildInputs = with ocamlPackages; [
71+
reason
72+
melange
73+
];
74+
propagatedBuildInputs = with ocamlPackages; [
75+
dune_3
76+
ocaml
77+
ppxlib
78+
melange
79+
quickjs
80+
lwt
81+
lwt_ppx
82+
integers
83+
uri
84+
];
85+
src = inputs.server-reason-react;
86+
};
87+
in
88+
{
89+
devShells = {
90+
default = mkShell.override { stdenv = pkgs.clang18Stdenv; } {
91+
buildInputs = with ocamlPackages; [
92+
dune_3
93+
ocaml
94+
utop
95+
ocamlformat
96+
];
97+
inputsFrom = [ self.packages."${system}".default ];
98+
packages = builtins.attrValues {
99+
inherit (pkgs) clang_18 clang-tools_18 pkg-config;
100+
inherit (ocamlPackages) ocaml-lsp ocamlformat-rpc-lib;
101+
};
102+
};
103+
};
104+
packages = {
105+
default = buildDunePackage {
106+
inherit version;
107+
pname = "styled-ppx";
108+
nativeBuildInputs = with ocamlPackages; [ ];
109+
propagatedBuildInputs = with ocamlPackages; [
110+
alcotest
111+
dune_3
112+
fmt
113+
melange
114+
menhir
115+
ocaml
116+
ppx_deriving
117+
ppx_deriving_yojson
118+
ppxlib
119+
reason
120+
reason-react
121+
reason-react-ppx
122+
sedlex
123+
server-reason-react
124+
yojson
125+
];
126+
src = ./.;
127+
};
128+
};
129+
formatter = pkgs.alejandra;
130+
}
131+
);
132+
}

0 commit comments

Comments
 (0)