Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
Expand Down Expand Up @@ -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 ? { } }:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nix/charon-ml.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let
buildInputs = [
ocamlPackages.dune_3
ocamlPackages.ocaml
ocamlPackages.ocamlformat
ocamlPackages.ocamlformat_0_26_2
];
buildPhase = ''
if ! dune build @fmt; then
Expand Down
2 changes: 1 addition & 1 deletion nix/charon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
, rustToolchain
, stdenv
, zlib
,
}:

let
Expand Down Expand Up @@ -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 ''
Expand Down