From ddc42c89fbd9ee1eb4ff31b8428c1f15a1f23ac0 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 1 May 2026 17:30:12 +0200 Subject: [PATCH] add #fuzz devshell and make fuzzing work on nixos --- Cargo.lock | 1 + flake.nix | 8 ++++++++ fuzz/Cargo.toml | 9 +++------ nix/compile.nix | 8 ++++++++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0294a62c..06e65724 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1548,6 +1548,7 @@ name = "garage-fuzz" version = "0.0.0" dependencies = [ "arbitrary", + "garage_db", "garage_model", "garage_table", "libfuzzer-sys", diff --git a/flake.nix b/flake.nix index 00f0efe1..25a3fee5 100644 --- a/flake.nix +++ b/flake.nix @@ -95,6 +95,14 @@ killall ]; }; + + # dev shell for fuzzing + fuzz = pkgs.mkShell { + buildInputs = with pkgs; [ + targets.toolchainNightly + cargo-fuzz + ]; + }; }; }); } diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 92c81409..40b0a118 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -11,12 +11,9 @@ cargo-fuzz = true arbitrary = { workspace = true, features = ["derive"]} libfuzzer-sys = { workspace = true } -[dependencies.garage_table] -path = "../src/table" - -[dependencies.garage_model] -path = "../src/model" -features = ["arbitrary"] +garage_db.workspace = true +garage_table.workspace = true +garage_model = { workspace = true, default-features = false, features = ["arbitrary"] } [[bin]] name = "version_crdt" diff --git a/nix/compile.nix b/nix/compile.nix index 799bcc10..da81f093 100644 --- a/nix/compile.nix +++ b/nix/compile.nix @@ -148,6 +148,14 @@ let in rec { toolchain = toolchainFn pkgs; + toolchainNightly = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { + targets = lib.optionals (target != null) [ rustTarget ]; + extensions = [ + "rust-src" + "rustfmt" + ]; + }); + devShell = pkgs.mkShell { buildInputs = [ toolchain