hook: Make `cargo check` and `cargo clippy` only execute pre-push
These hook take relatively long on my machine, and my impatience has lead to me doing `git commit --no-verify`, which defeats the purpose of having these hooks. Note that others (like `alejandra`, `cargo fmt` and `shellcheck`) are reasonably fast and will keep doing good.
This commit is contained in:
parent
5553a14752
commit
59a1021410
48
flake.lock
48
flake.lock
|
|
@ -65,10 +65,32 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"git-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1742649964,
|
||||||
|
"narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"gitignore": {
|
"gitignore": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"pre-commit-hooks",
|
"git-hooks",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -118,39 +140,17 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pre-commit-hooks": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"gitignore": "gitignore",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1742649964,
|
|
||||||
"narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"advisory-db": "advisory-db",
|
"advisory-db": "advisory-db",
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
|
"git-hooks": "git-hooks",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs-stable"
|
"nixpkgs-stable"
|
||||||
],
|
],
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"pre-commit-hooks": "pre-commit-hooks",
|
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
10
flake.nix
10
flake.nix
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
crane.url = "github:ipetkov/crane";
|
crane.url = "github:ipetkov/crane";
|
||||||
|
|
||||||
pre-commit-hooks = {
|
git-hooks = {
|
||||||
url = "github:cachix/git-hooks.nix";
|
url = "github:cachix/git-hooks.nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
@ -108,15 +108,19 @@
|
||||||
|
|
||||||
# Set of checks that are run: `nix flake check`
|
# Set of checks that are run: `nix flake check`
|
||||||
checks = {
|
checks = {
|
||||||
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
pre-commit-check = inputs.git-hooks.lib.${system}.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
settings.rust.check.cargoDeps = pkgs.rustPlatform.importCargoLock {lockFile = ./Cargo.lock;};
|
settings.rust.check.cargoDeps = pkgs.rustPlatform.importCargoLock {lockFile = ./Cargo.lock;};
|
||||||
hooks = {
|
hooks = {
|
||||||
alejandra.enable = true;
|
alejandra.enable = true;
|
||||||
rustfmt.enable = true;
|
rustfmt.enable = true;
|
||||||
cargo-check.enable = true;
|
cargo-check = {
|
||||||
|
enable = true;
|
||||||
|
stages = ["pre-push"];
|
||||||
|
};
|
||||||
clippy = {
|
clippy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
stages = ["pre-push"];
|
||||||
settings.denyWarnings = true;
|
settings.denyWarnings = true;
|
||||||
packageOverrides.cargo = rustToolchain;
|
packageOverrides.cargo = rustToolchain;
|
||||||
packageOverrides.clippy = rustToolchain;
|
packageOverrides.clippy = rustToolchain;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue