diff --git a/cad/default.nix b/cad/default.nix index 0b1c996..6d7a890 100644 --- a/cad/default.nix +++ b/cad/default.nix @@ -96,6 +96,12 @@ example = "3dfiles"; }; }; + + formatter = { + enable = lib.mkEnableOption "treefmt for formatting multiple types of files" // {default = true;}; + + nix = lib.mkEnableOption "formatting for nix files" // {default = true;}; + }; }; config = lib.mkIf cfg.enable { @@ -116,11 +122,6 @@ // cfg.devShell.extraAttrs; }; - # Formatter for nix files, available through 'nix fmt' - treefmt = { - programs.alejandra.enable = lib.mkDefault true; - }; - # Your custom packages # Accessible through 'nix build', 'nix shell', 'nix run', etc packages = lib.mkIf cfg.package.enable { @@ -152,6 +153,11 @@ } ''; }; + + # Formatter for nix files, available through 'nix fmt' + treefmt = lib.mkIf cfg.formatter.enable { + programs.alejandra.enable = lib.mkIf cfg.formatter.nix true; + }; }; }); }; diff --git a/rust/default.nix b/rust/default.nix index f87feb4..9b5611a 100644 --- a/rust/default.nix +++ b/rust/default.nix @@ -123,6 +123,19 @@ }; }; + formatter = { + enable = lib.mkEnableOption "treefmt for formatting multiple types of files" // {default = true;}; + + nix = lib.mkEnableOption "formatting for nix files" // {default = true;}; + rust = lib.mkEnableOption "formatting for rust files" // {default = true;}; + }; + + checks = { + enable = lib.mkEnableOption "checks for rust" // {default = true;}; + + linter = lib.mkEnableOption "lints for rust" // {default = true;}; + }; + craneLib = lib.mkOption { description = "The crane lib instance this module is using. Useful for overriding options"; default = craneLib; @@ -148,15 +161,6 @@ // cfg.devShell.extraAttrs; }; - # Formatter for nix files, available through 'nix fmt' - treefmt = { - programs.alejandra.enable = lib.mkDefault true; - programs.rustfmt = { - enable = true; - edition = manifest.edition; - }; - }; - # Your custom packages # Accessible through 'nix build', 'nix shell', 'nix run', etc packages = lib.mkIf cfg.package.enable { @@ -167,11 +171,20 @@ // cfg.package.extraAttrs; }; - checks = { - clippy = craneLib.cargoClippy { + # Formatter for nix files, available through 'nix fmt' + treefmt = lib.mkIf cfg.formatter.enable { + programs.alejandra.enable = lib.mkIf cfg.formatter.nix true; + programs.rustfmt = lib.mkIf cfg.formatter.rust { + enable = true; + edition = manifest.edition; + }; + }; + + checks = lib.mkIf cfg.checks.enable { + clippy = lib.mkIf cfg.checks.linter (craneLib.cargoClippy { inherit src buildInputs nativeBuildInputs cargoArtifacts; cargoClippyExtraArgs = "-- --deny warnings"; - }; + }); }; }; });