Skip to content

Commit efb128c

Browse files
committed
flake-module: enable treefmt as default formatter for the flake
1 parent 0e0a870 commit efb128c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

flake-module.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,20 @@ in
2727
```
2828
'';
2929
type = types.submoduleWith {
30-
modules = (import ./.).all-modules pkgs;
30+
modules = (import ./.).all-modules pkgs ++ [{
31+
options.flakeFormatter = lib.mkOption {
32+
type = types.bool;
33+
default = true;
34+
description = lib.mdDoc ''
35+
Enables `treefmt` the default formatter used by the `nix fmt` command
36+
'';
37+
};
38+
}];
3139
};
3240
};
3341
config = {
3442
checks.treefmt = config.treefmt.build.check self;
43+
formatter = lib.mkIf config.treefmt.flakeFormatter (lib.mkDefault config.treefmt.build.wrapper);
3544
};
3645
});
3746
};

0 commit comments

Comments
 (0)