nix: Refactor treefmt; use flake-root

This commit is contained in:
Sridhar Ratnakumar 2022-12-21 20:31:32 -05:00
parent 33436a1fde
commit c9c69b1afc

View file

@ -36,10 +36,14 @@
# Auto formatters. This also adds a flake check to ensure that the # Auto formatters. This also adds a flake check to ensure that the
# source tree was auto formatted. # source tree was auto formatted.
treefmt.config = { treefmt.config = {
inherit (config.flake-root) projectRootFile;
package = pkgs.treefmt; package = pkgs.treefmt;
projectRootFile = "flake.nix";
programs.ormolu.enable = true; programs.ormolu.enable = true;
programs.nixpkgs-fmt.enable = true;
programs.cabal-fmt.enable = true;
# We use fourmolu
programs.ormolu.package = pkgs.haskellPackages.fourmolu; programs.ormolu.package = pkgs.haskellPackages.fourmolu;
settings.formatter.ormolu = { settings.formatter.ormolu = {
options = [ options = [
@ -47,10 +51,6 @@
"-XImportQualifiedPost" "-XImportQualifiedPost"
]; ];
}; };
programs.nixpkgs-fmt.enable = true;
programs.cabal-fmt.enable = true;
}; };
# Dev shell scripts. # Dev shell scripts.