flake-modules: add treefmt to fix the 'nix fmt' command

This commit is contained in:
Gaetan Lepage 2024-05-07 16:45:47 +02:00 committed by Gaétan Lepage
parent ba545ded79
commit f7f255afe2
4 changed files with 58 additions and 3 deletions

View file

@ -2,13 +2,24 @@
{
imports = [
inputs.pre-commit-hooks.flakeModule
inputs.treefmt-nix.flakeModule
./devshell.nix
];
perSystem =
{ pkgs, ... }:
{ pkgs, config, ... }:
{
formatter = pkgs.nixfmt-rfc-style;
formatter = config.treefmt.build.wrapper;
treefmt.config = {
inherit (config.flake-root) projectRootFile;
package = pkgs.treefmt;
programs = {
nixfmt-rfc-style.enable = true;
statix.enable = true;
};
};
pre-commit = {
settings.hooks = {