Skip to content

Commit

Permalink
nix: Build with OCaml 5.2
Browse files Browse the repository at this point in the history
This changes flake.nix to build Merlin with OCaml 5.2 in order to
support 5.2-only features.

Nixpkgs needed to be updated too.
  • Loading branch information
Julow committed May 16, 2024
1 parent c42e0cb commit 4aacce3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 33 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.

50 changes: 20 additions & 30 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,37 @@
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 (pkgs.ocamlPackages) buildDunePackage;
in
rec {

inherit (ocamlPackages) buildDunePackage;
in rec {
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 {
Expand All @@ -55,33 +52,26 @@
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"; };
};
};
devShells.default = pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = with pkgs.ocamlPackages; [ ocaml-lsp ];
buildInputs = with ocamlPackages; [ ocaml-lsp ];
};
});
}

0 comments on commit 4aacce3

Please sign in to comment.