Skip to content

Commit

Permalink
Merge branch 'main' into unify
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Feb 16, 2025
2 parents 579a237 + c903fec commit f2c0f5d
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 111 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
schedule:
- cron: 0 1 * * MON

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: read-all

jobs:
Expand Down
67 changes: 7 additions & 60 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 59 additions & 45 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,57 +1,71 @@
{
description = "melange-json Nix Flake";

inputs.nix-filter.url = "github:numtide/nix-filter";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs = {
url = "github:nix-ocaml/nix-overlays";
inputs.flake-utils.follows = "flake-utils";
};
inputs.nixpkgs.url = "github:nix-ocaml/nix-overlays";

outputs = { self, nixpkgs, flake-utils, nix-filter }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}".appendOverlays [
(self: super: {
outputs = { self, nixpkgs }:
let
forAllSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend (self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_2;
})
];
inherit (pkgs) nodejs_latest lib stdenv darwin;
});
in
f pkgs);
in
{
packages = forAllSystems (pkgs:
let
melange-json = with pkgs.ocamlPackages; buildDunePackage {
pname = "melange-json";
version = "dev";

melange-json = with pkgs.ocamlPackages; buildDunePackage {
pname = "melange-json";
version = "dev";
src =
let fs = pkgs.lib.fileset; in
fs.toSource {
root = ./.;
fileset = fs.unions [
./dune-project
./dune
./melange-json.opam
./melange-json-native.opam
./src
./ppx
];
};

src = ./.;
nativeBuildInputs = with pkgs.ocamlPackages; [ melange ];
propagatedBuildInputs = with pkgs.ocamlPackages; [
melange
yojson
ppxlib
];
};

mkShell = { buildInputs ? [ ] }: pkgs.mkShell {
inputsFrom = [ melange-json ];
nativeBuildInputs = with pkgs; [
yarn
nodejs_latest
] ++ (with pkgs.ocamlPackages; [
ocamlformat
merlin
melange-jest
reason
]);
inherit buildInputs;
};
in
rec {
packages.default = melange-json;
devShells = {
nativeBuildInputs = with pkgs.ocamlPackages; [ melange ];
propagatedBuildInputs = with pkgs.ocamlPackages; [
melange
yojson
ppxlib
];
};
in
{ inherit melange-json; default = melange-json; });
devShells = forAllSystems (pkgs:
let
inherit (pkgs) nodejs_latest ocamlPackages system yarn;
mkShell = { buildInputs ? [ ] }: pkgs.mkShell {
inputsFrom = [ self.packages.${system}.melange-json ];
nativeBuildInputs = [
yarn
nodejs_latest
] ++ (with ocamlPackages; [
ocamlformat
merlin
melange-jest
reason
]);
inherit buildInputs;
};
in
{
default = mkShell { };
release = mkShell {
buildInputs = with pkgs; [ cacert curl ocamlPackages.dune-release git ];
};
};
});
}
);
};
}
2 changes: 1 addition & 1 deletion ppx/test/poly.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
We can alias poly varaints:
We can alias poly variants:
$ echo '
> type t = [`A | `B] [@@deriving json]
> type u = t [@@deriving json]
Expand Down
2 changes: 1 addition & 1 deletion ppx/test/ppx_deriving_json_js.e2e.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
> (name lib)
> (modes melange)
> (modules example example_json_string main)
> (flags :standard -w -37-69 -open Json.Primitives)
> (flags :standard -w -20-37-69 -open Json.Primitives)
> (preprocess (pps melange.ppx melange-json.ppx)))
> (melange.emit
> (alias js)
Expand Down
4 changes: 2 additions & 2 deletions ppx/test/ppx_deriving_json_js_variants.e2e.t
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

$ echo '(lang dune 3.11)
$ echo '(lang dune 3.11)
> (using melange 0.1)' > dune-project

$ echo '
> (library
> (name lib)
> (modes melange)
> (modules main)
> (flags :standard -w -37-69)
> (flags :standard -w -20-37-69)
> (preprocess (pps melange.ppx melange-json.ppx)))
> (melange.emit
> (alias js)
Expand Down
4 changes: 2 additions & 2 deletions ppx/test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ echo '
(name lib)
(modes melange)
(modules main_js)
(flags :standard -w -37-69 -open Json.Primitives)
(flags :standard -w -20-37-69 -open Json.Primitives)
(preprocess (pps melange.ppx melange-json.ppx)))
(melange.emit
(alias js)
(target output)
(modules)
(libraries lib)
(module_systems commonjs))
(executable
(executable
(name main)
(modules main)
(flags :standard -w -37-69 -open Json.Primitives)
Expand Down

0 comments on commit f2c0f5d

Please sign in to comment.