Skip to content

Commit

Permalink
nix: treefmt -> git-hooks.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Jan 3, 2025
1 parent ece9d75 commit 105fdc8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ cabal.project.local~
result
result-*

.direnv
.direnv
/.pre-commit-config.yaml
40 changes: 18 additions & 22 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 15 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
haskell-flake.url = "github:srid/haskell-flake";

process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
fourmolu-nix.url = "github:jedimahdi/fourmolu-nix";
git-hooks.url = "github:cachix/git-hooks.nix";
git-hooks.flake = false;

ema.url = "github:srid/ema";
ema.inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -20,10 +20,10 @@
imports = [
inputs.haskell-flake.flakeModule
inputs.process-compose-flake.flakeModule
inputs.treefmt-nix.flakeModule
inputs.fourmolu-nix.flakeModule
(inputs.git-hooks + /flake-module.nix)
];
perSystem = { config, self', pkgs, lib, ... }:
perSystem = { config, pkgs, lib, ... }:
let
tailwind = pkgs.haskellPackages.tailwind;
in
Expand All @@ -36,18 +36,16 @@
autoWire = [ "packages" "apps" "checks" ];
};

# Auto formatters. This also adds a flake check to ensure that the
# source tree was auto formatted.
treefmt.config = {
projectRootFile = "flake.nix";

programs.fourmolu.enable = true;
programs.nixpkgs-fmt.enable = true;
programs.cabal-fmt.enable = true;
programs.hlint.enable = true;

# We use fourmolu
programs.fourmolu.package = config.fourmolu.wrapper;
pre-commit.settings = {
hooks = {
nixpkgs-fmt.enable = true;
cabal-fmt.enable = true;
fourmolu = {
enable = true;
package = config.fourmolu.wrapper;
};
hlint.enable = true;
};
};

fourmolu.settings = {
Expand Down Expand Up @@ -105,7 +103,7 @@
];
inputsFrom = [
config.haskellProjects.default.outputs.devShell
config.treefmt.build.devShell
config.pre-commit.devShell
];
};
};
Expand Down

0 comments on commit 105fdc8

Please sign in to comment.