{
description = "rs3a";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};
outputs = {
self,
nixpkgs,
flake-utils,
pre-commit-hooks,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
cargo-check.enable = true;
commitizen.enable = true;
typos.enable = true;
typos-commit = {
enable = true;
description = "Find typos in commit message";
entry = let script = pkgs.writeShellScript "typos-commit" ''
typos "$1"
''; in builtins.toString script;
stages = [ "commit-msg" ];
};
cargo-test = {
enable = true;
name = "cargo test (workspace)";
entry = "cargo test --workspace --all-features";
pass_filenames = false;
stages = [ "pre-commit" ];
};
};
};
};
in {
devShells.default = pkgs.mkShell {
inherit (checks.pre-commit-check) shellHook;
buildInputs = with pkgs; [
cargo
# clippy
typos
commitizen
];
};
});
}