From 9d2422b4cd86323236578c20fe76443462e7eaba Mon Sep 17 00:00:00 2001 From: Matthew Kenigsberg Date: Tue, 1 Oct 2024 11:59:00 -0600 Subject: [PATCH] Add extraArgs for clippy I would like to pass `--tests` to clippy. I figured rather than adding an option just for tests, it might be better to just add an option to pass through any arguments --- modules/hooks.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index 10d2c577..a71d86df 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -232,6 +232,11 @@ in description = "Run clippy with --all-features"; default = false; }; + extraArgs = mkOption { + type = types.str; + description = "Additional arguments to pass to clippy"; + default = ""; + }; }; config.extraPackages = [ @@ -2073,7 +2078,7 @@ in description = "Lint Rust code."; package = wrapper; packageOverrides = { cargo = tools.cargo; clippy = tools.clippy; }; - entry = "${hooks.clippy.package}/bin/cargo-clippy clippy ${cargoManifestPathArg} ${lib.optionalString hooks.clippy.settings.offline "--offline"} ${lib.optionalString hooks.clippy.settings.allFeatures "--all-features"} -- ${lib.optionalString hooks.clippy.settings.denyWarnings "-D warnings"}"; + entry = "${hooks.clippy.package}/bin/cargo-clippy clippy ${cargoManifestPathArg} ${lib.optionalString hooks.clippy.settings.offline "--offline"} ${lib.optionalString hooks.clippy.settings.allFeatures "--all-features"} ${hooks.clippy.settings.extraArgs} -- ${lib.optionalString hooks.clippy.settings.denyWarnings "-D warnings"}"; files = "\\.rs$"; pass_filenames = false; };