Skip to content

Commit b967ed2

Browse files
committed
ci: add pre-commit-config
1 parent 955a304 commit b967ed2

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ on:
55
- master
66
pull_request:
77
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: cachix/install-nix-action@v16
13+
with:
14+
extra_nix_config: |
15+
experimental-features = nix-command flakes
16+
- name: nix build
17+
run: nix develop --command "pre-commit run --all-files"
818
nix-build:
919
runs-on: ubuntu-latest
1020
steps:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ result
1919
result-*
2020
*.drv
2121
.direnv
22-

.pre-commit-config.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
repos:
2+
- repo: meta
3+
hooks:
4+
- id: check-hooks-apply
5+
- id: check-useless-excludes
6+
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v4.1.0
9+
hooks:
10+
- id: check-added-large-files
11+
- id: check-case-conflict
12+
- id: check-merge-conflict
13+
- id: check-toml
14+
- id: check-vcs-permalinks
15+
- id: check-yaml
16+
- id: destroyed-symlinks
17+
- id: detect-private-key
18+
- id: end-of-file-fixer
19+
- id: fix-byte-order-marker
20+
- id: mixed-line-ending
21+
- id: trailing-whitespace
22+
23+
- repo: local
24+
hooks:
25+
- id: cargo-fmt
26+
name: cargo fmt
27+
entry: cargo fmt
28+
types: [rust]
29+
language: system
30+
pass_filenames: false
31+
- id: cargo-check
32+
name: cargo check
33+
entry: cargo check
34+
types: [rust]
35+
language: system
36+
pass_filenames: false
37+
- id: cargo-clippy
38+
name: cargo clippy
39+
entry: cargo clippy -- --deny warnings
40+
types: [rust]
41+
language: system
42+
pass_filenames: false
43+
- id: nixpkgs-fmt
44+
entry: nixpkgs-fmt
45+
types: [nix]
46+
language: system
47+
name: nixpkgs-fmt

flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@
6868

6969
nixpkgs-fmt
7070
rnix-lsp
71+
72+
pre-commit
7173
];
74+
shellHook = ''
75+
pre-commit install --install-hooks
76+
'';
7277
};
7378
});
7479
}

rust-toolchain.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ targets = [
1414
"x86_64-pc-windows-gnu",
1515
"x86_64-apple-darwin"
1616
]
17-

0 commit comments

Comments
 (0)