Skip to content

Commit

Permalink
pre-commit-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
leo60228 committed Jul 11, 2024
1 parent 5978e4b commit ad84385
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
secrets/
.pre-commit-config.yaml
77 changes: 77 additions & 0 deletions flake.lock

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

17 changes: 17 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};

outputs =
{
Expand All @@ -68,6 +72,7 @@
colmena,
flake-utils,
treefmt-nix,
pre-commit-hooks,
...
}@flakes:
(
Expand Down Expand Up @@ -165,6 +170,13 @@
inherit bootstrap;
};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks.treefmt = {
enable = true;
package = treefmtEval.config.build.wrapper;
};
};
in
{
inherit packages;
Expand All @@ -189,8 +201,13 @@
}) packages;
formatter = treefmtEval.config.build.wrapper;
checks = {
inherit pre-commit-check;
formatting = treefmtEval.config.build.check self;
};
devShells.default = pkgs.mkShell {
inherit (pre-commit-check) shellHook;
buildInputs = pre-commit-check.enabledPackages;
};
}
))
);
Expand Down

0 comments on commit ad84385

Please sign in to comment.