From bc7f84a854ab298f1eb8f84bd48fcb260a0162c5 Mon Sep 17 00:00:00 2001 From: Reed Krantz Date: Thu, 4 Jun 2026 21:28:32 -0500 Subject: [PATCH] feat(rust): add the krantz.rust.cargoArtifacts.extraAttrs option --- rust/default.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rust/default.nix b/rust/default.nix index db9162f..2700ac8 100644 --- a/rust/default.nix +++ b/rust/default.nix @@ -43,9 +43,9 @@ # Build *just* the cargo dependencies, so we can reuse # all of that work (e.g. via cachix) when running in CI - cargoArtifacts = craneLib.buildDepsOnly { + cargoArtifacts = craneLib.buildDepsOnly ({ inherit src buildInputs nativeBuildInputs; - }; + } // cfg.cargoArtifacts.extraAttrs); in { options.krantz.rust = { enable = lib.mkEnableOption "building a cargo project with crane"; @@ -96,6 +96,17 @@ ]; }; + cargoArtifacts = { + extraAttrs = lib.mkOption { + description = "Extra attributes to merge into buildDepsOnly. See https://crane.dev/API.html#cranelibbuilddepsonly"; + type = lib.types.attrs; + default = {}; + example = { + doCheck = false; + }; + }; + }; + devShell = { enable = lib.mkEnableOption "a rust development environment" // {default = true;};