@@ -0,0 +1,43 @@
1+{ buildPythonPackage
2+, fetchFromGitHub
3+, fetchPypi
4+, git
5+, isPy27
6+, lib
7+, pytestCheckHook
8+, ruamel_yaml
9+, toml
10+}:
11+
12+buildPythonPackage rec {
13+ pname = "pre-commit-hooks";
14+ version = "3.3.0";
15+ disabled = isPy27;
16+
17+ # fetchPypi does not provide tests
18+ src = fetchFromGitHub {
19+ owner = "pre-commit";
20+ repo = pname;
21+ rev = "v${version}";
22+ sha256 = "1sppwcqsbr9gv2cpjslngcbggsxvdr84zgrin94yjr40jgkjzdpq";
23+ };
24+
25+ propagatedBuildInputs = [ toml ruamel_yaml ];
26+ checkInputs = [ git pytestCheckHook ];
27+
28+ # the tests require a functional git installation which requires a valid HOME
29+ # directory.
30+ preCheck = ''
31+ export HOME="$(mktemp -d)"
32+
33+ git config --global user.name "Nix Builder"
34+ git config --global user.email "nix-builder@nixos.org"
35+ '';
36+
37+ meta = with lib; {
38+ description = "Some out-of-the-box hooks for pre-commit";
39+ homepage = "https://github.com/pre-commit/pre-commit-hooks";
40+ license = licenses.mit;
41+ maintainers = with maintainers; [ kalbasit ];
42+ };
43+}