You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
804 B

2 years ago
  1. { pkgs, ... }:
  2. let
  3. nix-pre-commit-hooks = import (pkgs.fetchFromGitHub {
  4. owner = "cachix";
  5. repo = "pre-commit-hooks.nix";
  6. rev = "ff9c0b459ddc4b79c06e19d44251daa8e9cd1746";
  7. sha256 = "jlsQb2y6A5dB1R0wVPLOfDGM0wLyfYqEJNzMtXuzCXw=";
  8. });
  9. in
  10. nix-pre-commit-hooks.run {
  11. src = ./.;
  12. hooks = {
  13. check-format = {
  14. enable = true;
  15. files = "\\.rs$";
  16. entry = "cargo fmt -- --check";
  17. };
  18. doctest = {
  19. enable = true;
  20. entry = "cargo test --doc";
  21. files = "\\.rs$";
  22. pass_filenames = false;
  23. };
  24. # The hook "clippy" that ships with nix-precommit-hooks is outdated.
  25. cargo-clippy = {
  26. enable = true;
  27. description = "Lint Rust code.";
  28. entry = "cargo-clippy";
  29. files = "\\.rs$";
  30. pass_filenames = false;
  31. };
  32. };
  33. }