From b6fc502576077696d1a7fa23a74adbf50803e4a6 Mon Sep 17 00:00:00 2001
From: Allan Blanchard <allan.blanchard@cea.fr>
Date: Wed, 14 Sep 2022 14:34:31 +0200
Subject: [PATCH] [nix] Update commit + fixes - more recent Nix commit - update
 camlp5 for OCaml 4.14 - downgrade menhir for Alt-Ergo 2.2

---
 nix/camlp5.nix    |  7 +++++--
 nix/menhirLib.nix | 27 +++++++++++++++++++++++++++
 nix/odoc.nix      | 36 ------------------------------------
 nix/pkgs.nix      |  2 +-
 nix/sources.json  |  6 +++---
 5 files changed, 36 insertions(+), 42 deletions(-)
 create mode 100644 nix/menhirLib.nix
 delete mode 100644 nix/odoc.nix

diff --git a/nix/camlp5.nix b/nix/camlp5.nix
index 0cccdbe19cd..32622ab43f7 100644
--- a/nix/camlp5.nix
+++ b/nix/camlp5.nix
@@ -31,12 +31,15 @@ stdenv.mkDerivation rec {
   prefixKey = "-prefix ";
 
   preConfigure = ''
-    configureFlagsArray=(--strict --libdir $out/lib/ocaml/${ocaml.version}/site-lib)
+    configureFlagsArray=(--strict -libdir $out/lib/ocaml/${ocaml.version}/site-lib)
     patchShebangs ./config/find_stuffversion.pl
     patchShebangs ./etc/META.pl
   '';
 
-  buildFlags = [ "world.opt" ];
+  buildPhase = ''
+    make world.opt
+    make all
+  '';
 
   dontStrip = true;
 
diff --git a/nix/menhirLib.nix b/nix/menhirLib.nix
new file mode 100644
index 00000000000..34d8e09e0e5
--- /dev/null
+++ b/nix/menhirLib.nix
@@ -0,0 +1,27 @@
+{ lib, fetchFromGitLab, buildDunePackage }:
+
+buildDunePackage rec {
+  pname = "menhirLib";
+  version = "20211128";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.inria.fr";
+    owner = "fpottier";
+    repo = "menhir";
+    rev = version;
+    sha256 = "0j7ba5z7rwf85zi56fd3zfp7dvhr6xlj9amambxx57szys6dzz1g";
+  };
+
+  meta = with lib; {
+    homepage = "http://pauillac.inria.fr/~fpottier/menhir/";
+    description = "Runtime support library for parsers generated by Menhir";
+    longDescription = ''
+      Menhir is a LR(1) parser generator for the Objective Caml programming
+      language.  That is, Menhir compiles LR(1) grammar specifications down
+      to OCaml code.  Menhir was designed and implemented by François Pottier
+      and Yann Régis-Gianas.
+    '';
+    license = with licenses; [ lgpl2Only ];
+    maintainers = with maintainers; [ vbgl ];
+  };
+}
diff --git a/nix/odoc.nix b/nix/odoc.nix
deleted file mode 100644
index be33056888d..00000000000
--- a/nix/odoc.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{ lib
-, astring
-, buildDunePackage
-, cmdliner
-, cppo
-, fetchFromGitHub
-, fmt
-, fpath
-, ocaml
-, odoc-parser
-, result
-, tyxml
-}:
-
-buildDunePackage rec {
-  pname = "odoc";
-  version = "2.1.0";
-
-  minimumOCamlVersion = "4.02";
-
-  src = fetchFromGitHub {
-    owner = "ocaml";
-    repo = pname;
-    rev = version;
-    sha256 = "1ycb468pc6vsvqj176j99bmbkrr9saxvyn9qhpazi01abbcq5d90";
-  };
-
-  buildInputs = [ astring cmdliner cppo fmt fpath odoc-parser result tyxml ];
-
-  meta = {
-    description = "A documentation generator for OCaml";
-    license = lib.licenses.isc;
-    maintainers = [ lib.maintainers.vbgl ];
-    homepage = "https://github.com/ocaml/odoc";
-  };
-}
diff --git a/nix/pkgs.nix b/nix/pkgs.nix
index 91e9de7a7fd..8ef822c08e7 100644
--- a/nix/pkgs.nix
+++ b/nix/pkgs.nix
@@ -6,9 +6,9 @@ let
     camlp5 = oself.callPackage ./camlp5.nix {};
     camlzip = oself.callPackage ./camlzip.nix {};
     headache = oself.callPackage ./headache.nix {};
+    menhirLib = oself.callPackage ./menhirLib.nix {};
     mlmpfr = oself.callPackage ./mlmpfr.nix {};
     ocp-indent = oself.callPackage ./ocp-indent.nix {};
-    odoc = oself.callPackage ./odoc.nix {};
     psmt2-frontend = oself.callPackage ./psmt2-frontend.nix {};
     why3 = oself.callPackage ./why3.nix {};
 
diff --git a/nix/sources.json b/nix/sources.json
index 05861c9fb44..556c74ebc4b 100644
--- a/nix/sources.json
+++ b/nix/sources.json
@@ -29,10 +29,10 @@
         "homepage": "https://github.com/NixOS/nixpkgs",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "f4dfed73ee886b115a99e5b85fdfbeb683290d83",
-        "sha256": "1scpisl06f9mc31khj0m2q21yvx108bi7l9s0n9aq8f1w4fjprg6",
+        "rev": "5f326e2a403e1cebaec378e72ceaf5725983376d",
+        "sha256": "01lfac9zr1sx0whkd25d3jww3y3wcbyv4dck684k774p5gfx1wjy",
         "type": "tarball",
-        "url": "https://github.com/NixOS/nixpkgs/archive/f4dfed73ee886b115a99e5b85fdfbeb683290d83.tar.gz",
+        "url": "https://github.com/NixOS/nixpkgs/archive/5f326e2a403e1cebaec378e72ceaf5725983376d.tar.gz",
         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
     },
     "why3": {
-- 
GitLab