From b17fd79da468b3f81dc2ac901b129e9effa1574c Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 4 Apr 2025 14:19:57 +0200 Subject: [PATCH 1/3] Properly pin ocamlformat version --- nix/charon-ml.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/charon-ml.nix b/nix/charon-ml.nix index 8a90489e9..ef8679472 100644 --- a/nix/charon-ml.nix +++ b/nix/charon-ml.nix @@ -53,7 +53,7 @@ let buildInputs = [ ocamlPackages.dune_3 ocamlPackages.ocaml - ocamlPackages.ocamlformat + ocamlPackages.ocamlformat_0_26_2 ]; buildPhase = '' if ! dune build @fmt; then From 11f7813f2829d55e3db364fbac593868ffaa8f69 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 4 Apr 2025 14:24:18 +0200 Subject: [PATCH 2/3] Check running charon via nix --- flake.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index d35322ab5..a953210dd 100644 --- a/flake.nix +++ b/flake.nix @@ -69,6 +69,12 @@ touch $out ''; + # Test usage of charon via nix, to ensure the paths are set up correctly. + test-charon-via-nix = pkgs.runCommand "test-charon-via-nix" { } '' + echo "fn main() {}" > foo.rs + ${charon}/bin/charon rustc --no-serialize --print-llbc -- foo.rs > $out + ''; + # A utility that extracts the llbc of a crate using charon. This uses # `crane` to handle dependencies and toolchain management. extractCrateWithCharon = { name, src, charonFlags ? "", craneExtraArgs ? { } }: @@ -134,7 +140,7 @@ checks = { default = charon-ml-tests; inherit charon-ml-tests charon-check-fmt charon-check-no-rustc - charon-ml-check-fmt check-generated-ml; + charon-ml-check-fmt check-generated-ml test-charon-via-nix; }; # Export this function so that users of charon can use it in nix. This From f6ca29f020a9c0e088360fe1f3384065f11268e1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 4 Apr 2025 14:57:25 +0200 Subject: [PATCH 3/3] Update nixpkgs --- flake.lock | 12 ++++++------ flake.nix | 2 +- nix/charon.nix | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 3ae20f29d..ec7659896 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1727316705, - "narHash": "sha256-/mumx8AQ5xFuCJqxCIOFCHTVlxHkMT21idpbgbm/TIE=", + "lastModified": 1743700120, + "narHash": "sha256-8BjG/P0xnuCyVOXlYRwdI1B8nVtyYLf3oDwPSimqREY=", "owner": "ipetkov", "repo": "crane", - "rev": "5b03654ce046b5167e7b0bccbd8244cb56c16f0e", + "rev": "e316f19ee058e6db50075115783be57ac549c389", "type": "github" }, "original": { @@ -50,11 +50,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727634051, - "narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", + "lastModified": 1743583204, + "narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9", + "rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a953210dd..be4c3a4aa 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ nixpkgs-ocaml.follows = "nixpkgs"; rust-overlay = { # We pin a specific commit because we require a relatively recent version - # and flake dependents don't look at flake.lock. + # and flake dependents don't look at our flake.lock. url = "github:oxalica/rust-overlay/275c824ed9e90e7fd4f96d187bde3670062e721f"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/nix/charon.nix b/nix/charon.nix index affad1035..eed95dbcd 100644 --- a/nix/charon.nix +++ b/nix/charon.nix @@ -6,7 +6,6 @@ , rustToolchain , stdenv , zlib -, }: let @@ -48,6 +47,7 @@ craneLib.buildPackage ( '' wrapProgram $out/bin/charon \ --set CHARON_TOOLCHAIN_IS_IN_PATH 1 \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ rustToolchain ]}" \ --prefix PATH : "${lib.makeBinPath [ rustToolchain ]}" '' + (lib.optionalString stdenv.isDarwin ''