File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 2323
2424 configFormat = pkgs . formats . toml { } ;
2525
26+ # Remove keys in the setting that are "empty" to keep the config file lean
27+ emptySettingsKeys =
28+ lib . optional ( config . settings . excludes == [ ] ) "excludes"
29+ ++ lib . optional ( config . settings . on-unmatched == null ) "on-unmatched" ;
30+
31+ settingsData = builtins . removeAttrs config . settings emptySettingsKeys ;
32+
33+ configFile = configFormat . generate "treefmt.toml" settingsData ;
34+
2635 # The schema of the treefmt.toml data structure.
2736 configSchema = mkOption {
2837 default = { } ;
3645 default = [ ] ;
3746 example = [ "node_modules/*" ] ;
3847 } ;
48+
3949 on-unmatched = mkOption {
4050 description = "Log paths that did not match any formatters at the specified log level." ;
41- type = types . enum [
51+ type = types . nullOr ( types . enum [
4252 "debug"
4353 "info"
4454 "warn"
4555 "error"
4656 "fatal"
47- ] ;
48- default = "warn" ;
57+ ] ) ;
58+ default = null ;
4959 } ;
5060
5161 formatter = mkOption {
324334
325335 # Config
326336 config . build = {
327- configFile = configFormat . generate "treefmt.toml" config . settings ;
337+ inherit configFile ;
328338 devShell = pkgs . mkShell {
329339 nativeBuildInputs = [ config . build . wrapper ] ++ ( lib . attrValues config . build . programs ) ;
330340 } ;
You can’t perform that action at this time.
0 commit comments