To use these options, set the config
argument in the call
to mkCheck
or mkFormatter
in your
flake.nix
like that:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.05";
nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack";
};
outputs = { self, nixpkgs, nix-formatter-pack }: {
formatter.x86_64-linux = nix-formatter-pack.lib.mkFormatter {
inherit nixpkgs;
system = "x86_64-linux";
# or a custom instance of nixpkgs:
# pkgs = import nixpkgs { inherit system; };
# extensible with custom modules:
# extraModules = [ otherFlake.nixFormatterPackModules.default ];
config
= {
tools = {
deadnix.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
};
};
};
};
}
_module.args
Type: lazy attribute set of raw value
Declared by:
<nix-formatter-pack/lib/modules.nix>
|
formatters
Set of all formatters to run on script execution.
Type: attribute set of (submodule)
Default:
{
}
Declared by:
<nix-formatter-pack/module.nix>
|
formatters.<name>.enable
Whether to enable formatter.
Type: boolean
Default: true
Example: true
Declared by:
<nix-formatter-pack/module.nix>
|
formatters.<name>.commandFn
Command for formatter. Receives at least checkOnly
as boolean
and files
as a string.
Must return a non-zero exit code when checkOnly
is true and the
check fails. Should return zero exit code when checkOnly
is false
and all issues could be fixed.
For more complex commands, use pkgs.writeScript
like
{ checkOnly, files, ... }: "${pkgs.writeScript "nixpkgs-fmt" '' ${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt ${lib.optionalString checkOnly "--check"} "$@" '' } ${files}";
Type: function that evaluates to a(n) (optionally newline-terminated) single-line string
Example:
{ checkOnly, files, ... }: '' ${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt ${lib.optionalString checkOnly "--check"} ${files} ''
Declared by:
<nix-formatter-pack/module.nix>
|
formatters.<name>.name
Name of formatter.
Type: string
Default: "‹name›"
Declared by:
<nix-formatter-pack/module.nix>
|
tools.alejandra.enable
Whether to enable alejandra.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/alejandra.nix>
|
tools.deadnix.enable
Whether to enable deadnix.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.deadnix.checkHiddenFiles
Recurse into hidden subdirectories and process hidden .*.nix
files.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.deadnix.noLambdaArg
Don't check lambda parameter arguments.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.deadnix.noLambdaPatternNames
Don't check lambda attrset pattern names (don't break nixpkgs' callPackage
).
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.deadnix.noUnderscore
Don't check any bindings that start with a _
.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.nixfmt.enable
Whether to enable nixfmt.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/nixfmt.nix>
|
tools.nixfmt.maxWidth
Maximum width in characters.
Type: null or signed integer
Default: null
Declared by:
<nix-formatter-pack/tools/nixfmt.nix>
|
tools.nixpkgs-fmt.enable
Whether to enable nixpkgs-fmt.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/nixpkgs-fmt.nix>
|
tools.statix.enable
Whether to enable statix.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/statix.nix>
|
tools.statix.disabledLints
Disabled lints, see offical statix docs for list of all available lints.
Note: When this option is used, no other config file will be read by statix.
Type: list of string
Default:
[
]
Declared by:
<nix-formatter-pack/tools/statix.nix>
|
tools.statix.unrestricted
Don't respect .gitignore
files.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/statix.nix>
|