2021-07-10 17:41:22 +02:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2020-12-14 19:52:20 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
2021-07-10 17:41:22 +02:00
|
|
|
, pythonOlder
|
2020-12-14 19:52:20 +01:00
|
|
|
, pytestCheckHook
|
|
|
|
, ruamel_yaml
|
|
|
|
, toml
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pre-commit-hooks";
|
2021-07-10 17:41:22 +02:00
|
|
|
version = "4.0.1";
|
|
|
|
disabled = pythonOlder "3.6";
|
2020-12-14 19:52:20 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pre-commit";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-07-10 17:41:22 +02:00
|
|
|
sha256 = "sha256-Rg2I79r0Pp3AUgT6mD+kEdm+5CEGgdmFn6G3xcU6fnk=";
|
2020-12-14 19:52:20 +01:00
|
|
|
};
|
|
|
|
|
2021-07-10 17:41:22 +02:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
ruamel_yaml
|
|
|
|
toml
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
git
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-12-14 19:52:20 +01:00
|
|
|
|
|
|
|
# the tests require a functional git installation which requires a valid HOME
|
|
|
|
# directory.
|
|
|
|
preCheck = ''
|
|
|
|
export HOME="$(mktemp -d)"
|
|
|
|
|
|
|
|
git config --global user.name "Nix Builder"
|
|
|
|
git config --global user.email "nix-builder@nixos.org"
|
|
|
|
'';
|
|
|
|
|
2021-07-10 17:41:22 +02:00
|
|
|
pythonImportsCheck = [ "pre_commit_hooks" ];
|
|
|
|
|
2020-12-14 19:52:20 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Some out-of-the-box hooks for pre-commit";
|
|
|
|
homepage = "https://github.com/pre-commit/pre-commit-hooks";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ kalbasit ];
|
|
|
|
};
|
|
|
|
}
|