Skip to content

Commit

Permalink
Merge pull request #1769 from Julow/nix-ocaml-52
Browse files Browse the repository at this point in the history
nix: Build with OCaml 5.2
  • Loading branch information
voodoos authored May 17, 2024
2 parents 6b5fe77 + 2ac4c23 commit 4fccc83
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 37 deletions.
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

0 comments on commit 4fccc83

Please sign in to comment.