Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix: Build with OCaml 5.2 #1769

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

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

57 changes: 27 additions & 30 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,43 @@
outputs = { self, nixpkgs, flake-utils, menhir-repository }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}".extend (_: super: {
ocamlPackages = super.ocamlPackages.overrideScope' (_: osuper: {
pkgs = nixpkgs.legacyPackages."${system}";

# Build with OCaml 5.2
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_2.overrideScope'
(_: osuper: {
# Override menhirLib to the pinned version
menhirLib = osuper.menhirLib.overrideAttrs (_: {
version = "20201216";
src = menhir-repository;
});

inherit (packages) merlin-lib dot-merlin-reader merlin;
});
});
inherit (pkgs.ocamlPackages) buildDunePackage;
in
rec {

inherit (ocamlPackages) buildDunePackage;

packages = rec {
default = merlin;
merlin-lib = buildDunePackage {
pname = "merlin-lib";
version = "dev";
src = ./.;
duneVersion = "3";
propagatedBuildInputs = with pkgs.ocamlPackages; [
csexp
];
propagatedBuildInputs = with ocamlPackages; [ csexp ];
doCheck = true;
};

dot-merlin-reader = buildDunePackage {
pname = "dot-merlin-reader";
version = "dev";
src = ./.;
duneVersion = "3";
propagatedBuildInputs = [
pkgs.ocamlPackages.findlib
];
buildInputs = [
merlin-lib
];
propagatedBuildInputs = [ ocamlPackages.findlib ];
buildInputs = [ merlin-lib ];
doCheck = true;
};

merlin = buildDunePackage {
pname = "merlin";
version = "dev";
Expand All @@ -55,33 +56,29 @@
buildInputs = [
merlin-lib
dot-merlin-reader
pkgs.ocamlPackages.menhirLib
pkgs.ocamlPackages.menhirSdk
pkgs.ocamlPackages.yojson
];
nativeBuildInputs = [
pkgs.ocamlPackages.menhir
pkgs.jq
ocamlPackages.menhirLib
ocamlPackages.menhirSdk
ocamlPackages.yojson
];
nativeBuildInputs = [ ocamlPackages.menhir pkgs.jq ];
nativeCheckInputs = [ dot-merlin-reader ];
checkInputs = with pkgs.ocamlPackages; [
ppxlib
];
checkInputs = with ocamlPackages; [ ppxlib ];
doCheck = true;
checkPhase = ''
runHook preCheck
patchShebangs tests/merlin-wrapper
dune build @check @runtest
runHook postCheck
'';
meta = with pkgs; {
mainProgram = "ocamlmerlin";
};
'';
meta = with pkgs; { mainProgram = "ocamlmerlin"; };
};
};
in {
inherit packages;

devShells.default = pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = with pkgs.ocamlPackages; [ ocaml-lsp ];
buildInputs = with ocamlPackages; [ merlin ];
};
});
}
5 changes: 1 addition & 4 deletions tests/test-dirs/inconsistent-assumptions.t
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,10 @@ Do an update that breaks the build:
$ cd _build
$ $OCAMLC -c -w @a-40-41-42-49-70 -short-paths -open My_lib__ -o my_lib__Import import.ml
$ $OCAMLC -c -w @a-40-41-42-49-70 -short-paths -open My_lib__ -o my_lib__Bar bar.ml
$ $OCAMLC -c -w @a-40-41-42-49-70 -short-paths -open My_lib__ -o my_lib__Foo foo.ml
$ $OCAMLC -c -w @a-40-41-42-49-70 -short-paths -open My_lib__ -o my_lib__Foo foo.ml 2>&1 | head -n 3
File "foo.ml", line 4, characters 11-12:
4 | let x, _ = x + 1, Bar.b
^
Error: This expression has type char but an expression was expected of type
int
[2]
$ cd ..

Go to the file, and ask merlin to move you to the error:
Expand Down
Loading