Skip to content

Commit 2e71266

Browse files
cfcostarvcas
authored andcommitted
chore: add pre-commit-hooks with the formatter
1 parent 4959063 commit 2e71266

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

flake.lock

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
44
flake-utils.url = "github:numtide/flake-utils";
5+
gitignore = {
6+
url = "github:hercules-ci/gitignore.nix";
7+
inputs.nixpkgs.follows = "nixpkgs";
8+
};
59
treefmt-nix = {
610
url = "github:numtide/treefmt-nix";
711
inputs.nixpkgs.follows = "nixpkgs";
@@ -10,12 +14,20 @@
1014
url = "github:oxalica/rust-overlay";
1115
inputs.nixpkgs.follows = "nixpkgs";
1216
};
17+
pre-commit-hooks = {
18+
url = "github:cachix/pre-commit-hooks.nix";
19+
inputs = {
20+
nixpkgs.follows = "nixpkgs";
21+
gitignore.follows = "gitignore";
22+
};
23+
};
1324
};
1425

1526
outputs =
1627
{
1728
nixpkgs,
1829
flake-utils,
30+
pre-commit-hooks,
1931
rust-overlay,
2032
treefmt-nix,
2133
...
@@ -63,6 +75,19 @@
6375
};
6476
}).config.build.wrapper;
6577

78+
pre-commit-check = pre-commit-hooks.lib.${system}.run {
79+
src = ./.;
80+
81+
hooks = {
82+
deadnix.enable = true;
83+
nixfmt-rfc-style.enable = true;
84+
treefmt = {
85+
enable = true;
86+
package = room-formatter;
87+
};
88+
};
89+
};
90+
6691
packages.default = rustPlatform.buildRustPackage rec {
6792
name = "room";
6893
src = ./.;
@@ -83,6 +108,8 @@
83108
{
84109
inherit packages;
85110

111+
checks = { inherit pre-commit-check; };
112+
86113
devShells.default = mkShell {
87114
name = "room";
88115

0 commit comments

Comments
 (0)