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