~kaction/cookiecutter-haskell

2e1f1acb79b4aecbdbc010af59ee1a2ced78efea — Dmitry Bogatov 1 year, 5 months ago b061939
Add treefmt.toml to automatically reformat sources

Additionally, tweak make package derivation fail to build if sources is
formatted incorrectly.
2 files changed, 10 insertions(+), 4 deletions(-)

M {{cookiecutter.project_name}}/default.nix
A {{cookiecutter.project_name}}/treefmt.toml
M {{cookiecutter.project_name}}/default.nix => {{cookiecutter.project_name}}/default.nix +5 -4
@@ 9,10 9,11 @@ let
  myHaskellPackages = pkgs.haskell.packages.${compiler}.override {
    overrides = hself: hsuper: {
      "{{cookiecutter.project_name}}" =
        hself.callCabal2nix
          "{{cookiecutter.project_name}}"
          (gitignore ./.)
          {};
          let this = hself.callCabal2nix "{{cookiecutter.project_name}}" (gitignore ./.) {};
          in this.overrideAttrs (old: {
            postPatch = "treefmt --fail-on-change";
            nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.treefmt pkgs.haskellPackages.ormolu ];
          });
    };
  };


A {{cookiecutter.project_name}}/treefmt.toml => {{cookiecutter.project_name}}/treefmt.toml +5 -0
@@ 0,0 1,5 @@
[formatter.haskell]
command = "ormolu"
options = ["-i"]
includes = [ "*.hs" ]
excludes = []