From 194c049f6511e61371ea6af75a3ab95f332ffc45 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Thu, 6 Jun 2024 15:19:53 +0200 Subject: [PATCH] pin OCaml dependencies --- engine/dune-project | 36 ++++++++++++++++++------------------ engine/hax-engine.opam | 36 ++++++++++++++++++------------------ flake.nix | 25 +++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 36 deletions(-) diff --git a/engine/dune-project b/engine/dune-project index 6df3f59e8..77c89a50f 100644 --- a/engine/dune-project +++ b/engine/dune-project @@ -22,24 +22,24 @@ (depends ocaml dune - (base (>= "0.16.2")) - core - yojson - non_empty_list - pprint - ppx_deriving_yojson - ppx_yojson_conv - ppx_sexp_conv - ppx_compare - ppx_hash - ppx_deriving - cmdliner - angstrom - re - ppx_matches - ppx_string - logs - ocamlgraph + (base (= "0.16")) + (core (= "0.16")) + (yojson (= "2.2")) + (non_empty_list (= "0.1")) + (pprint (= "0.1")) + (ppx_deriving_yojson (= "3.7")) + (ppx_yojson_conv (= "0.15")) + (ppx_sexp_conv (= "0.16")) + (ppx_compare (= "0.16")) + (ppx_hash (= "0.16")) + (ppx_deriving (= "5.2")) + (cmdliner (= "1.3")) + (angstrom (= "0.16")) + (re (= "1.11")) + (ppx_matches (= "0.1")) + (ppx_string (= "0.16")) + (logs (= "0.7")) + (ocamlgraph (= "2.1")) js_of_ocaml-compiler js_of_ocaml diff --git a/engine/hax-engine.opam b/engine/hax-engine.opam index dfa6b8be5..4a279b26e 100644 --- a/engine/hax-engine.opam +++ b/engine/hax-engine.opam @@ -13,24 +13,24 @@ bug-reports: "https://github.com/hacspec/hax/issues" depends: [ "ocaml" "dune" {>= "3.0"} - "base" {>= "0.16.2"} - "core" - "yojson" - "non_empty_list" - "pprint" - "ppx_deriving_yojson" - "ppx_yojson_conv" - "ppx_sexp_conv" - "ppx_compare" - "ppx_hash" - "ppx_deriving" - "cmdliner" - "angstrom" - "re" - "ppx_matches" - "ppx_string" - "logs" - "ocamlgraph" + "base" {= "0.16"} + "core" {= "0.16"} + "yojson" {= "2.2"} + "non_empty_list" {= "0.1"} + "pprint" {= "0.1"} + "ppx_deriving_yojson" {= "3.7"} + "ppx_yojson_conv" {= "0.15"} + "ppx_sexp_conv" {= "0.16"} + "ppx_compare" {= "0.16"} + "ppx_hash" {= "0.16"} + "ppx_deriving" {= "5.2"} + "cmdliner" {= "1.3"} + "angstrom" {= "0.16"} + "re" {= "1.11"} + "ppx_matches" {= "0.1"} + "ppx_string" {= "0.16"} + "logs" {= "0.7"} + "ocamlgraph" {= "2.1"} "js_of_ocaml-compiler" "js_of_ocaml" "js_of_ocaml-ppx" diff --git a/flake.nix b/flake.nix index b85e532e6..903de2440 100644 --- a/flake.nix +++ b/flake.nix @@ -85,6 +85,31 @@ check-toolchain = checks.toolchain; check-examples = checks.examples; check-readme-coherency = checks.readme-coherency; + + # `updated-dune-project` returns the `engine/dune-project` + # file with the versions locked by Nix + updated-dune-project = (packages.hax-engine.override { + hax-rust-frontend = pkgs.hello; + hax-engine-names-extract = pkgs.hello; + }).overrideAttrs (old: { + name = "dune-project"; + outputs = ["out"]; + buildPhase = '' + dune describe installed-libraries > /tmp/dune-installed-libraries + + for package in $(grep -Po '^ {8}[(]\K\w+' dune-project); do + version=$(cat /tmp/dune-installed-libraries | grep -Po "\b$package\b.*version: v?\K[0-9.]+" | head -n1 || true) + version=$(echo "$version" | grep -Po "^\d+.\d+" || true) + if [ -z "${"$"}{version}" ]; then + continue + fi + ${pkgs.sd}/bin/sd "(^ {8}[(]$package +)\([^)]+\)" '${"$"}{1}'"(= \"$version\")" dune-project + echo "-> $package: $version" + done + ''; + checkPhase = "true"; + installPhase = "cat dune-project > $out"; + }); }; checks = { toolchain = packages.hax.tests;