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.argsType: lazy attribute set of raw value
Declared by:
<nix-formatter-pack/lib/modules.nix>
|
formattersSet of all formatters to run on script execution.
Type: attribute set of (submodule)
Default:
{
}
Declared by:
<nix-formatter-pack/module.nix>
|
formatters.<name>.enableWhether to enable formatter.
Type: boolean
Default: true
Example: true
Declared by:
<nix-formatter-pack/module.nix>
|
formatters.<name>.commandFnCommand 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>.nameName of formatter.
Type: string
Default: "‹name›"
Declared by:
<nix-formatter-pack/module.nix>
|
tools.alejandra.enableWhether to enable alejandra.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/alejandra.nix>
|
tools.deadnix.enableWhether to enable deadnix.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.deadnix.checkHiddenFilesRecurse into hidden subdirectories and process hidden .*.nix files.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.deadnix.noLambdaArgDon't check lambda parameter arguments.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.deadnix.noLambdaPatternNamesDon'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.noUnderscoreDon't check any bindings that start with a _.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/deadnix.nix>
|
tools.nixfmt.enableWhether to enable nixfmt.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/nixfmt.nix>
|
tools.nixfmt.maxWidthMaximum width in characters.
Type: null or signed integer
Default: null
Declared by:
<nix-formatter-pack/tools/nixfmt.nix>
|
tools.nixpkgs-fmt.enableWhether to enable nixpkgs-fmt.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/nixpkgs-fmt.nix>
|
tools.statix.enableWhether to enable statix.
Type: boolean
Default: false
Example: true
Declared by:
<nix-formatter-pack/tools/statix.nix>
|
tools.statix.disabledLintsDisabled 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.unrestrictedDon't respect .gitignore files.
Type: boolean
Default: false
Declared by:
<nix-formatter-pack/tools/statix.nix>
|