Open bobvanderlinden opened 1 year ago
@zimbatm do you think this is a good idea?
Sounds good! Probably the integration can be done similar to https://github.com/numtide/treefmt-nix/blob/main/flake-module.nix
The perfect combination of nix flake + devenv + direnv saves 90% of the development environment configuration time for newcomers who have just entered the project.
After integrating treefmt, it will further increase to 99%.
The last 1% will be implemented in treefmt to "watch file changes and automate formats" obtained after the features.
I took care of this integration in my last PR. Let me know if anything needs to be changed.
treefmt
is a CLI tool to format all files in a repository. It recurses through a directory and calls the right formatter based on the type of file it finds.treefmt
requires a configuration file that tells it what to execute for each file type. It doesn't include this configuration by default, so it takes some time to get the configuration right and requires knowledge of the different kinds of formatters that you'd like the use. Knowledge like which CLI flags to use.treefmt-nix
is a Nix module system to build a treefmt configuration. It includes options for most of the different formatters and allows just enabling them. The same kind of module system devenv uses.For instance:
It would be nice if this could be integrated into devenv, so that you could have options in devenv like:
This probably requires adding treefmt-nix as a Nix flake input to devenv. Is this something we'd want?