feat: add enable options for formatters and checks
Flake.lock: update Nix dependencies for development environment only / nix-flake-update (push) Successful in 1m54s
Flake.lock: update Nix dependencies for development environment only / nix-flake-update (push) Successful in 1m54s
This commit is contained in:
+11
-5
@@ -96,6 +96,12 @@
|
|||||||
example = "3dfiles";
|
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 {
|
config = lib.mkIf cfg.enable {
|
||||||
@@ -116,11 +122,6 @@
|
|||||||
// cfg.devShell.extraAttrs;
|
// cfg.devShell.extraAttrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Formatter for nix files, available through 'nix fmt'
|
|
||||||
treefmt = {
|
|
||||||
programs.alejandra.enable = lib.mkDefault true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Your custom packages
|
# Your custom packages
|
||||||
# Accessible through 'nix build', 'nix shell', 'nix run', etc
|
# Accessible through 'nix build', 'nix shell', 'nix run', etc
|
||||||
packages = lib.mkIf cfg.package.enable {
|
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
@@ -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 {
|
craneLib = lib.mkOption {
|
||||||
description = "The crane lib instance this module is using. Useful for overriding options";
|
description = "The crane lib instance this module is using. Useful for overriding options";
|
||||||
default = craneLib;
|
default = craneLib;
|
||||||
@@ -148,15 +161,6 @@
|
|||||||
// cfg.devShell.extraAttrs;
|
// 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
|
# Your custom packages
|
||||||
# Accessible through 'nix build', 'nix shell', 'nix run', etc
|
# Accessible through 'nix build', 'nix shell', 'nix run', etc
|
||||||
packages = lib.mkIf cfg.package.enable {
|
packages = lib.mkIf cfg.package.enable {
|
||||||
@@ -167,11 +171,20 @@
|
|||||||
// cfg.package.extraAttrs;
|
// cfg.package.extraAttrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
checks = {
|
# Formatter for nix files, available through 'nix fmt'
|
||||||
clippy = craneLib.cargoClippy {
|
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;
|
inherit src buildInputs nativeBuildInputs cargoArtifacts;
|
||||||
cargoClippyExtraArgs = "-- --deny warnings";
|
cargoClippyExtraArgs = "-- --deny warnings";
|
||||||
};
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user