forked from numtide/treefmt-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeadnix.nix
33 lines (30 loc) · 862 Bytes
/
deadnix.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
lib,
config,
mkFormatterModule,
...
}:
let
cfg = config.programs.deadnix;
in
{
meta.maintainers = [ ];
imports = [
(mkFormatterModule {
name = "deadnix";
args = [ "--edit" ];
includes = [ "*.nix" ];
})
];
options.programs.deadnix = {
no-lambda-arg = lib.mkEnableOption "Don't check lambda parameter arguments";
no-lambda-pattern-names = lib.mkEnableOption "Don't check lambda attrset pattern names (don't break nixpkgs callPackage)";
no-underscore = lib.mkEnableOption "Don't check any bindings that start with a _";
};
config = lib.mkIf cfg.enable {
settings.formatter.deadnix.options =
(lib.optional cfg.no-lambda-arg "--no-lambda-arg")
++ (lib.optional cfg.no-lambda-pattern-names "--no-lambda-pattern-names")
++ (lib.optional cfg.no-underscore "--no-underscore");
};
}