feat: add enable options for formatters and checks
Flake.lock: update Nix dependencies for development environment only / nix-flake-update (push) Successful in 1m54s

This commit is contained in:
2026-04-28 18:52:59 -05:00
parent b4f51b4209
commit 72c39db45c
2 changed files with 36 additions and 17 deletions
+11 -5
View File
@@ -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;
};
};
});
};
+25 -12
View File
@@ -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";
};
});
};
};
});