Skip to content

Commit

Permalink
feat(statix): add config-option
Browse files Browse the repository at this point in the history
  • Loading branch information
sivizius committed Oct 9, 2024
1 parent 1211305 commit 09c5a00
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,14 @@ in
type = types.submodule {
imports = [ hookModule ];
options.settings = {
config =
mkOption {
type = types.nullOr types.path;
description = "Path to a custom config file.";
default = null;
example = lib.literalExpression "statix.toml";
};

format =
mkOption {
type = types.enum [ "stderr" "errfmt" "json" ];
Expand Down Expand Up @@ -3374,8 +3382,16 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
name = "statix";
description = "Lints and suggestions for the Nix programming language.";
package = tools.statix;
entry = with hooks.statix.settings;
"${hooks.statix.package}/bin/statix check -o ${format} ${if (ignore != [ ]) then "-i ${lib.escapeShellArgs (lib.unique ignore)}" else ""}";
entry =
let
inherit (hooks.statix) package settings;
options = lib.toGNUCommandLineShell
{
mkList = name: value: [ name ] ++ lib.unique value;
}
settings;
in
"${package}/bin/statix check ${options}";
files = "\\.nix$";
pass_filenames = false;
};
Expand Down

0 comments on commit 09c5a00

Please sign in to comment.